feat(auth): require changing default admin password (#778)

This commit is contained in:
h44z
2026-11-09 19:57:23 +01:00
committed by GitHub
parent 137286d46b
commit 276f120b60
30 changed files with 641 additions and 90 deletions
@@ -18,6 +18,7 @@ const (
type UserAuthenticator interface {
IsUserValid(ctx context.Context, id domain.UserIdentifier) bool
IsDefaultPasswordInUse(ctx context.Context) bool
}
type UserRepository interface {
@@ -74,6 +75,12 @@ func (h AuthenticationHandler) LoggedIn(scopes ...Scope) func(next http.Handler)
return
}
if h.authenticator.IsDefaultPasswordInUse(r.Context()) {
respond.JSON(w, http.StatusForbidden,
model.Error{Code: http.StatusForbidden, Message: "default admin password must be changed first"})
return
}
if !UserHasScopes(user, scopes...) {
// Abort the request with the appropriate error code
respond.JSON(w, http.StatusForbidden,