Can omit username from rendered RDP

This commit is contained in:
Jonathan Giroux 2023-10-05 11:37:53 +02:00
parent e9e592b43a
commit 3729b65a09
No known key found for this signature in database
GPG Key ID: 8D0FBD94F9E534EC
4 changed files with 10 additions and 3 deletions

View File

@ -135,6 +135,8 @@ Client:
# If true puts splits "user@domain.com" into the user and domain component so that
# domain gets set in the rdp file and the domain name is stripped from the username
SplitUserDomain: false
# If true, removes "username" (and "domain" if SplitUserDomain is true) from RDP file.
# NoUsername: true
Security:
# a random string of 32 characters to secure cookies on the client
# make sure to share this amongst different pods

View File

@ -93,6 +93,7 @@ type ClientConfig struct {
// kept for backwards compatibility
UsernameTemplate string `koanf:"usernametemplate"`
SplitUserDomain bool `koanf:"splituserdomain"`
NoUsername string `koanf:"nousername"`
}
func ToCamel(s string) string {

View File

@ -110,6 +110,7 @@ func main() {
RdpOpts: web.RdpOpts{
UsernameTemplate: conf.Client.UsernameTemplate,
SplitUserDomain: conf.Client.SplitUserDomain,
NoUsername: conf.Client.NoUsername,
},
GatewayAddress: url,
TemplateFile: conf.Client.Defaults,

View File

@ -37,6 +37,7 @@ type Config struct {
type RdpOpts struct {
UsernameTemplate string
SplitUserDomain bool
NoUsername bool
}
type Handler struct {
@ -210,9 +211,11 @@ func (h *Handler) HandleDownload(w http.ResponseWriter, r *http.Request) {
}
}
d.Settings.Username = render
if domain != "" {
d.Settings.Domain = domain
if !NoUsername {
d.Settings.Username = render
if domain != "" {
d.Settings.Domain = domain
}
}
d.Settings.FullAddress = host
d.Settings.GatewayHostname = h.gatewayAddress.Host