fix(auth): add oidc.issuer_url to use public-facing Authelia URL for browser redirects
This commit is contained in:
parent
e80b04e0c1
commit
34672eaedb
4 changed files with 11 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ authelia:
|
||||||
users_db_path: "/opt/authelia/users_database.yml"
|
users_db_path: "/opt/authelia/users_database.yml"
|
||||||
|
|
||||||
oidc:
|
oidc:
|
||||||
|
issuer_url: "https://auth.sechpoint.app"
|
||||||
client_id: "nextwks"
|
client_id: "nextwks"
|
||||||
client_secret: ""
|
client_secret: ""
|
||||||
redirect_url: "https://wks.lohmar.co.uk/auth/callback"
|
redirect_url: "https://wks.lohmar.co.uk/auth/callback"
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ authelia:
|
||||||
users_db_path: "/opt/authelia/users_database.yml"
|
users_db_path: "/opt/authelia/users_database.yml"
|
||||||
|
|
||||||
oidc:
|
oidc:
|
||||||
|
issuer_url: "https://auth.sechpoint.app"
|
||||||
client_id: "nextwks"
|
client_id: "nextwks"
|
||||||
client_secret: ""
|
client_secret: ""
|
||||||
redirect_url: "https://wks.lohmar.co.uk/auth/callback"
|
redirect_url: "https://wks.lohmar.co.uk/auth/callback"
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ type AutheliaConfig struct {
|
||||||
|
|
||||||
// OIDCConfig holds the OIDC provider settings (Authelia).
|
// OIDCConfig holds the OIDC provider settings (Authelia).
|
||||||
type OIDCConfig struct {
|
type OIDCConfig struct {
|
||||||
|
IssuerURL string `yaml:"issuer_url"` // Public-facing URL users reach (e.g., https://auth.sechpoint.app)
|
||||||
ClientID string `yaml:"client_id"`
|
ClientID string `yaml:"client_id"`
|
||||||
ClientSecret string `yaml:"client_secret"`
|
ClientSecret string `yaml:"client_secret"`
|
||||||
RedirectURL string `yaml:"redirect_url"`
|
RedirectURL string `yaml:"redirect_url"`
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,15 @@ func main() {
|
||||||
|
|
||||||
// Initialize session store and OIDC auth
|
// Initialize session store and OIDC auth
|
||||||
sessionStore := auth.NewSessionStore(database.DB)
|
sessionStore := auth.NewSessionStore(database.DB)
|
||||||
|
|
||||||
|
// OIDC issuer: public-facing URL (via Zoraxy) for browser redirects
|
||||||
|
// Falls back to authelia.host if not configured
|
||||||
|
issuerURL := cfg.OIDC.IssuerURL
|
||||||
|
if issuerURL == "" {
|
||||||
|
issuerURL = cfg.Authelia.Host
|
||||||
|
}
|
||||||
oidcCfg := auth.OIDCConfig{
|
oidcCfg := auth.OIDCConfig{
|
||||||
IssuerURL: cfg.Authelia.Host,
|
IssuerURL: issuerURL,
|
||||||
ClientID: cfg.OIDC.ClientID,
|
ClientID: cfg.OIDC.ClientID,
|
||||||
ClientSecret: cfg.OIDC.ClientSecret,
|
ClientSecret: cfg.OIDC.ClientSecret,
|
||||||
RedirectURL: cfg.OIDC.RedirectURL,
|
RedirectURL: cfg.OIDC.RedirectURL,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue