OIDC : scope groups par défaut, groupes du jeton dans le journal de refus ; bouton Paramètres ; réseau traefik-net
This commit is contained in:
1 parent
8c2f7a6bff
commit
fe81055421
5 files changed
+10
-3
No files matched your search
@@ -9,6 +9,9 @@ OIDC_ISSUER=
|
||||
OIDC_CLIENT_ID=
|
||||
OIDC_CLIENT_SECRET=
|
||||
OIDC_REDIRECT_URL=
|
||||
OIDC_SCOPES=openid profile email groups
|
||||
OIDC_GROUPS_CLAIM=groups
|
||||
OIDC_LOGOUT=true
|
||||
OIDC_NAME=SSO
|
||||
OIDC_ALLOWED_GROUPS=
|
||||
OIDC_ADMIN_GROUPS=
|
||||
|
||||
+1
-1
@@ -275,7 +275,7 @@ func oidcConfig(secret []byte, ttl time.Duration) (auth.Config, error) {
|
||||
ClientID: os.Getenv("OIDC_CLIENT_ID"),
|
||||
ClientSecret: secretEnv("OIDC_CLIENT_SECRET"),
|
||||
RedirectURL: os.Getenv("OIDC_REDIRECT_URL"),
|
||||
Scopes: fields(env("OIDC_SCOPES", "openid profile email")),
|
||||
Scopes: fields(env("OIDC_SCOPES", "openid profile email groups")),
|
||||
GroupsClaim: env("OIDC_GROUPS_CLAIM", "groups"),
|
||||
SessionTTL: ttl,
|
||||
Secret: secret,
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@ services:
|
||||
OIDC_CLIENT_ID: ${OIDC_CLIENT_ID:-}
|
||||
OIDC_CLIENT_SECRET: ${OIDC_CLIENT_SECRET:-}
|
||||
OIDC_REDIRECT_URL: ${OIDC_REDIRECT_URL:-}
|
||||
OIDC_SCOPES: ${OIDC_SCOPES:-openid profile email}
|
||||
# Ajouter « groups » pour OIDC_ALLOWED_GROUPS / OIDC_ADMIN_GROUPS.
|
||||
OIDC_SCOPES: ${OIDC_SCOPES:-openid profile email groups}
|
||||
OIDC_NAME: ${OIDC_NAME:-SSO}
|
||||
OIDC_ALLOWED_GROUPS: ${OIDC_ALLOWED_GROUPS:-}
|
||||
OIDC_GROUPS_CLAIM: ${OIDC_GROUPS_CLAIM:-groups}
|
||||
|
||||
@@ -186,6 +186,9 @@ function Shell({ me, reloadMe }: { me: Me; reloadMe: () => Promise<unknown> }) {
|
||||
<span>{title}</span>
|
||||
</a>
|
||||
<span className="spacer" />
|
||||
<button className="icon-btn" onClick={() => setSettings(me.admin ? "general" : "account")} aria-label="Paramètres" title="Paramètres">
|
||||
<SettingsIcon />
|
||||
</button>
|
||||
<button className="icon-btn" onClick={() => setTheme(theme === "dark" ? "light" : "dark")} aria-label={theme === "dark" ? "Thème clair" : "Thème sombre"} title={theme === "dark" ? "Thème clair" : "Thème sombre"}>
|
||||
{theme === "dark" ? <SunIcon /> : <MoonIcon />}
|
||||
</button>
|
||||
|
||||
@@ -347,7 +347,7 @@ func (a *OIDC) callback(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
user, err := a.exchange(r, q.Get("code"), st)
|
||||
if errors.Is(err, errForbidden) {
|
||||
slog.Warn("OIDC : accès refusé", "sub", user.Sub, "name", user.Name)
|
||||
slog.Warn("OIDC : accès refusé (groupes du jeton, à comparer à OIDC_ALLOWED_GROUPS)", "sub", user.Sub, "name", user.Name, "groups", user.Groups, "claim", a.cfg.GroupsClaim, "allowed", a.cfg.AllowedGroups)
|
||||
page(w, http.StatusForbidden, "Accès refusé",
|
||||
"Votre compte ("+user.Name+") n'appartient à aucun groupe autorisé.", "/auth/logout", "Changer de compte")
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user