mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2026-03-27 22:46:37 +00:00
Fix rdp setting and fix username can be nil with openid
This commit is contained in:
@@ -60,7 +60,7 @@ func (g *Gateway) HandleGatewayProtocol(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
var t *Tunnel
|
||||
|
||||
ctx := context.WithValue(r.Context(), common.TunnelCtx, t)
|
||||
ctx := r.Context()
|
||||
|
||||
connId := r.Header.Get(rdgConnectionIdKey)
|
||||
x, found := c.Get(connId)
|
||||
@@ -70,9 +70,15 @@ func (g *Gateway) HandleGatewayProtocol(w http.ResponseWriter, r *http.Request)
|
||||
RemoteAddr: ctx.Value(common.ClientIPCtx).(string),
|
||||
UserName: ctx.Value(common.UsernameCtx).(string),
|
||||
}
|
||||
// username can be nil with openid as it's only available later
|
||||
username := ctx.Value(common.UsernameCtx)
|
||||
if username != nil {
|
||||
t.UserName = username.(string)
|
||||
}
|
||||
} else {
|
||||
t = x.(*Tunnel)
|
||||
}
|
||||
ctx = context.WithValue(ctx, common.TunnelCtx, t)
|
||||
|
||||
if r.Method == MethodRDGOUT {
|
||||
if r.Header.Get("Connection") != "upgrade" && r.Header.Get("Upgrade") != "websocket" {
|
||||
|
||||
@@ -28,8 +28,8 @@ type RdpConnection struct {
|
||||
AlternateFullAddress string `rdp:"alternate full address"`
|
||||
Username string `rdp:"username"`
|
||||
Domain string `rdp:"domain"`
|
||||
GatewayCredentialSource int `rdp:"gatewaycredentialsource" default:"0"`
|
||||
GatewayCredentialMethode int `rdp:"gatewayprofileusagemethod" default:"0"`
|
||||
GatewayCredentialsSource int `rdp:"gatewaycredentialssource" default:"0"`
|
||||
GatewayCredentialMethod int `rdp:"gatewayprofileusagemethod" default:"0"`
|
||||
GatewayUsageMethod int `rdp:"gatewayusagemethod" default:"0"`
|
||||
GatewayAccessToken string `rdp:"gatewayaccesstoken"`
|
||||
PromptCredentialsOnce bool `rdp:"promptcredentialonce" default:"true"`
|
||||
|
||||
Reference in New Issue
Block a user