mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AuthN: Change error returned when sign up is disabled for provider (#65110)
This commit is contained in:
parent
335bcd1e4e
commit
d2b19c167b
@ -15,6 +15,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
errUserSignupDisabled = errutil.NewBase(
|
||||||
|
errutil.StatusUnauthorized,
|
||||||
|
"user.sync.signup-disabled",
|
||||||
|
errutil.WithPublicMessage("Sign up is disabled"),
|
||||||
|
)
|
||||||
errSyncUserForbidden = errutil.NewBase(
|
errSyncUserForbidden = errutil.NewBase(
|
||||||
errutil.StatusForbidden,
|
errutil.StatusForbidden,
|
||||||
"user.sync.forbidden",
|
"user.sync.forbidden",
|
||||||
@ -22,7 +27,7 @@ var (
|
|||||||
)
|
)
|
||||||
errSyncUserInternal = errutil.NewBase(
|
errSyncUserInternal = errutil.NewBase(
|
||||||
errutil.StatusInternal,
|
errutil.StatusInternal,
|
||||||
"user.sync.forbidden",
|
"user.sync.internal",
|
||||||
errutil.WithPublicMessage("User sync failed"),
|
errutil.WithPublicMessage("User sync failed"),
|
||||||
)
|
)
|
||||||
errUserProtection = errutil.NewBase(
|
errUserProtection = errutil.NewBase(
|
||||||
@ -73,7 +78,7 @@ func (s *UserSync) SyncUserHook(ctx context.Context, id *authn.Identity, _ *auth
|
|||||||
if errors.Is(errUserInDB, user.ErrUserNotFound) {
|
if errors.Is(errUserInDB, user.ErrUserNotFound) {
|
||||||
if !id.ClientParams.AllowSignUp {
|
if !id.ClientParams.AllowSignUp {
|
||||||
s.log.FromContext(ctx).Warn("Failed to create user, signup is not allowed for module", "auth_module", id.AuthModule, "auth_id", id.AuthID)
|
s.log.FromContext(ctx).Warn("Failed to create user, signup is not allowed for module", "auth_module", id.AuthModule, "auth_id", id.AuthID)
|
||||||
return errSyncUserForbidden.Errorf("%w", login.ErrSignupNotAllowed)
|
return errUserSignupDisabled.Errorf("%w", login.ErrSignupNotAllowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create user
|
// create user
|
||||||
|
Loading…
Reference in New Issue
Block a user