feat: add support for auto redirecting to oauth providers

This commit is contained in:
Stavros
2025-05-01 14:18:26 +03:00
parent 83483d6374
commit 773942dc3b
11 changed files with 129 additions and 27 deletions

View File

@@ -506,6 +506,7 @@ func (h *Handlers) AppHandler(c *gin.Context) {
GenericName: h.Config.GenericName,
Domain: h.Config.Domain,
ForgotPasswordMessage: h.Config.ForgotPasswordMessage,
OAuthAutoRedirect: h.Config.OAuthAutoRedirect,
}
// Return app context

View File

@@ -51,6 +51,7 @@ type AppContext struct {
GenericName string `json:"genericName"`
Domain string `json:"domain"`
ForgotPasswordMessage string `json:"forgotPasswordMessage"`
OAuthAutoRedirect string `json:"oauthAutoRedirect"`
}
// Totp request is the request for the totp endpoint

View File

@@ -26,6 +26,7 @@ type Config struct {
GenericName string `mapstructure:"generic-name"`
DisableContinue bool `mapstructure:"disable-continue"`
OAuthWhitelist string `mapstructure:"oauth-whitelist"`
OAuthAutoRedirect string `mapstructure:"oauth-auto-redirect" validate:"oneof=none github google generic"`
SessionExpiry int `mapstructure:"session-expiry"`
LogLevel int8 `mapstructure:"log-level" validate:"min=-1,max=5"`
Title string `mapstructure:"app-title"`
@@ -44,6 +45,7 @@ type HandlersConfig struct {
GenericName string
Title string
ForgotPasswordMessage string
OAuthAutoRedirect string
}
// OAuthConfig is the configuration for the providers