mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2026-03-31 16:06:35 +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
|
var t *Tunnel
|
||||||
|
|
||||||
ctx := context.WithValue(r.Context(), common.TunnelCtx, t)
|
ctx := r.Context()
|
||||||
|
|
||||||
connId := r.Header.Get(rdgConnectionIdKey)
|
connId := r.Header.Get(rdgConnectionIdKey)
|
||||||
x, found := c.Get(connId)
|
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),
|
RemoteAddr: ctx.Value(common.ClientIPCtx).(string),
|
||||||
UserName: ctx.Value(common.UsernameCtx).(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 {
|
} else {
|
||||||
t = x.(*Tunnel)
|
t = x.(*Tunnel)
|
||||||
}
|
}
|
||||||
|
ctx = context.WithValue(ctx, common.TunnelCtx, t)
|
||||||
|
|
||||||
if r.Method == MethodRDGOUT {
|
if r.Method == MethodRDGOUT {
|
||||||
if r.Header.Get("Connection") != "upgrade" && r.Header.Get("Upgrade") != "websocket" {
|
if r.Header.Get("Connection") != "upgrade" && r.Header.Get("Upgrade") != "websocket" {
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ type RdpConnection struct {
|
|||||||
AlternateFullAddress string `rdp:"alternate full address"`
|
AlternateFullAddress string `rdp:"alternate full address"`
|
||||||
Username string `rdp:"username"`
|
Username string `rdp:"username"`
|
||||||
Domain string `rdp:"domain"`
|
Domain string `rdp:"domain"`
|
||||||
GatewayCredentialSource int `rdp:"gatewaycredentialsource" default:"0"`
|
GatewayCredentialsSource int `rdp:"gatewaycredentialssource" default:"0"`
|
||||||
GatewayCredentialMethode int `rdp:"gatewayprofileusagemethod" default:"0"`
|
GatewayCredentialMethod int `rdp:"gatewayprofileusagemethod" default:"0"`
|
||||||
GatewayUsageMethod int `rdp:"gatewayusagemethod" default:"0"`
|
GatewayUsageMethod int `rdp:"gatewayusagemethod" default:"0"`
|
||||||
GatewayAccessToken string `rdp:"gatewayaccesstoken"`
|
GatewayAccessToken string `rdp:"gatewayaccesstoken"`
|
||||||
PromptCredentialsOnce bool `rdp:"promptcredentialonce" default:"true"`
|
PromptCredentialsOnce bool `rdp:"promptcredentialonce" default:"true"`
|
||||||
|
|||||||
Reference in New Issue
Block a user