Skip to content

Commit

Permalink
Allow default domain
Browse files Browse the repository at this point in the history
  • Loading branch information
bolkedebruin committed Aug 31, 2020
1 parent c6cfdc4 commit 8876b04
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
7 changes: 3 additions & 4 deletions api/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type Config struct {
BandwidthAutoDetect int
ConnectionType int
SplitUserDomain bool
DefaultDomain string
}

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

// split the username into user and domain
var user string
var domain string
var user = userName
var domain = c.DefaultDomain
if c.SplitUserDomain {
creds := strings.SplitN(userName, "@", 2)
user = creds[0]
if len(creds) > 1 {
domain = creds[1]
}
} else {
user = userName
}

render := user
Expand Down
1 change: 1 addition & 0 deletions config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type ClientConfig struct {
ConnectionType int
UsernameTemplate string
SplitUserDomain bool
DefaultDomain string
}

func init() {
Expand Down
14 changes: 1 addition & 13 deletions dev/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,4 @@ services:
volumes:
- ${PWD}/xrdp_users.txt:/root/createusers.txt
environment:
TZ: "Europe/London"
rdpgw:
build: .
ports:
- 9443:9443
restart: on-failure
depends_on:
- keycloak
healthcheck:
test: ["CMD", "curl", "-f", "http://keycloak:8080"]
interval: 30s
timeout: 10s
retries: 10
TZ: "Europe/Amsterdam"
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func main() {
BandwidthAutoDetect: conf.Client.BandwidthAutoDetect,
ConnectionType: conf.Client.ConnectionType,
SplitUserDomain: conf.Client.SplitUserDomain,
DefaultDomain: conf.Client.DefaultDomain,
}
api.NewApi()

Expand Down

0 comments on commit 8876b04

Please sign in to comment.