R77: bearer allowedUsers gate, session inUse CAS

This commit is contained in:
2026-08-13 18:07:32 +01:00
parent 60980b5eb6
commit 0e57c0cad3
5 changed files with 117 additions and 13 deletions
+12
View File
@@ -831,6 +831,18 @@ func (t *TraefikOidc) forwardAuthorized(rw http.ResponseWriter, req *http.Reques
}
}
// Bearer (M2M) path: enforce allowedUsers / allowedUserDomains the same
// way every cookie-path entry point does. The bearer path reaches here
// via buildPrincipalFromBearerToken with no earlier isAllowedUser check;
// without this, a valid bearer whose subject is absent from the
// allowlist would still be forwarded, making the restriction a no-op.
if p.Source == sourceBearer && !t.isAllowedUser(p.Identifier) {
t.logger.Infof("Bearer user %s is not in allowed users or domains", p.Identifier)
errorMsg := fmt.Sprintf("Access denied: User not allowed. To log out, visit: %s", t.logoutURLPath)
t.sendErrorResponse(rw, req, errorMsg, http.StatusForbidden)
return
}
if len(t.allowedRolesAndGroups) > 0 {
allowed := false
for _, roleOrGroup := range append(groups, roles...) {