mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2025-08-22 16:20:47 +02:00
Allow default domain
This commit is contained in:
parent
c6cfdc4dd4
commit
8876b04466
4 changed files with 6 additions and 17 deletions
|
@ -43,6 +43,7 @@ type Config struct {
|
||||||
BandwidthAutoDetect int
|
BandwidthAutoDetect int
|
||||||
ConnectionType int
|
ConnectionType int
|
||||||
SplitUserDomain bool
|
SplitUserDomain bool
|
||||||
|
DefaultDomain string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) NewApi() {
|
func (c *Config) NewApi() {
|
||||||
|
@ -158,16 +159,14 @@ func (c *Config) HandleDownload(w http.ResponseWriter, r *http.Request) {
|
||||||
host = strings.Replace(host, "{{ preferred_username }}", userName, 1)
|
host = strings.Replace(host, "{{ preferred_username }}", userName, 1)
|
||||||
|
|
||||||
// split the username into user and domain
|
// split the username into user and domain
|
||||||
var user string
|
var user = userName
|
||||||
var domain string
|
var domain = c.DefaultDomain
|
||||||
if c.SplitUserDomain {
|
if c.SplitUserDomain {
|
||||||
creds := strings.SplitN(userName, "@", 2)
|
creds := strings.SplitN(userName, "@", 2)
|
||||||
user = creds[0]
|
user = creds[0]
|
||||||
if len(creds) > 1 {
|
if len(creds) > 1 {
|
||||||
domain = creds[1]
|
domain = creds[1]
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
user = userName
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render := user
|
render := user
|
||||||
|
|
|
@ -58,6 +58,7 @@ type ClientConfig struct {
|
||||||
ConnectionType int
|
ConnectionType int
|
||||||
UsernameTemplate string
|
UsernameTemplate string
|
||||||
SplitUserDomain bool
|
SplitUserDomain bool
|
||||||
|
DefaultDomain string
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -33,16 +33,4 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ${PWD}/xrdp_users.txt:/root/createusers.txt
|
- ${PWD}/xrdp_users.txt:/root/createusers.txt
|
||||||
environment:
|
environment:
|
||||||
TZ: "Europe/London"
|
TZ: "Europe/Amsterdam"
|
||||||
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
|
|
||||||
|
|
1
main.go
1
main.go
|
@ -77,6 +77,7 @@ func main() {
|
||||||
BandwidthAutoDetect: conf.Client.BandwidthAutoDetect,
|
BandwidthAutoDetect: conf.Client.BandwidthAutoDetect,
|
||||||
ConnectionType: conf.Client.ConnectionType,
|
ConnectionType: conf.Client.ConnectionType,
|
||||||
SplitUserDomain: conf.Client.SplitUserDomain,
|
SplitUserDomain: conf.Client.SplitUserDomain,
|
||||||
|
DefaultDomain: conf.Client.DefaultDomain,
|
||||||
}
|
}
|
||||||
api.NewApi()
|
api.NewApi()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue