Skip to content

Commit 8876b04

Browse files
committed
Allow default domain
1 parent c6cfdc4 commit 8876b04

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed

api/web.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type Config struct {
4343
BandwidthAutoDetect int
4444
ConnectionType int
4545
SplitUserDomain bool
46+
DefaultDomain string
4647
}
4748

4849
func (c *Config) NewApi() {
@@ -158,16 +159,14 @@ func (c *Config) HandleDownload(w http.ResponseWriter, r *http.Request) {
158159
host = strings.Replace(host, "{{ preferred_username }}", userName, 1)
159160

160161
// split the username into user and domain
161-
var user string
162-
var domain string
162+
var user = userName
163+
var domain = c.DefaultDomain
163164
if c.SplitUserDomain {
164165
creds := strings.SplitN(userName, "@", 2)
165166
user = creds[0]
166167
if len(creds) > 1 {
167168
domain = creds[1]
168169
}
169-
} else {
170-
user = userName
171170
}
172171

173172
render := user

config/configuration.go

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type ClientConfig struct {
5858
ConnectionType int
5959
UsernameTemplate string
6060
SplitUserDomain bool
61+
DefaultDomain string
6162
}
6263

6364
func init() {

dev/docker/docker-compose.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,4 @@ services:
3333
volumes:
3434
- ${PWD}/xrdp_users.txt:/root/createusers.txt
3535
environment:
36-
TZ: "Europe/London"
37-
rdpgw:
38-
build: .
39-
ports:
40-
- 9443:9443
41-
restart: on-failure
42-
depends_on:
43-
- keycloak
44-
healthcheck:
45-
test: ["CMD", "curl", "-f", "http://keycloak:8080"]
46-
interval: 30s
47-
timeout: 10s
48-
retries: 10
36+
TZ: "Europe/Amsterdam"

main.go

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func main() {
7777
BandwidthAutoDetect: conf.Client.BandwidthAutoDetect,
7878
ConnectionType: conf.Client.ConnectionType,
7979
SplitUserDomain: conf.Client.SplitUserDomain,
80+
DefaultDomain: conf.Client.DefaultDomain,
8081
}
8182
api.NewApi()
8283

0 commit comments

Comments
 (0)