Handle HTTP/HTTPS protocol depending on dev env or not

This commit is contained in:
2022-11-07 01:35:06 +01:00
parent 356bfc6a86
commit e2ff98094b
6 changed files with 44 additions and 3 deletions

View File

@@ -45,6 +45,7 @@ type OIDCHandler struct {
NamespaceProviders map[string]fosite.OAuth2Provider
config OIDCConfig
handler handlers.MobilityAccountsHandler
Protocol string //HTTP (dev env) or HTTPS
PrivateKey *rsa.PrivateKey
}
@@ -66,10 +67,16 @@ func NewOIDCHandler(h handlers.MobilityAccountsHandler, storage storage.Storage,
providers[c.Namespace] = np
}
protocol := "https"
if config.GetBool("dev_env") {
protocol = "http"
}
return &OIDCHandler{
config: oidc_config,
handler: h,
NamespaceProviders: providers,
Protocol: protocol,
PrivateKey: privateKey,
}
}