grafana/pkg/services/ssosettings/errors.go
Misi bcc2409564
Auth: Add validation to Generic OAuth API and UI (#81345)
* wip

* Update validation

* Chore: Remove InputControl usage

* Fixes, validation

* Remove empty option

* Validation changes

* Add tests, rename

* lint

---------

Co-authored-by: Clarity-89 <homes89@ukr.net>
2024-01-29 12:04:22 +01:00

25 lines
931 B
Go

package ssosettings
import (
"github.com/grafana/grafana/pkg/util/errutil"
)
var (
errNotFoundBase = errutil.NotFound("sso.notFound", errutil.WithPublicMessage("The provider was not found."))
ErrNotFound = errNotFoundBase.Errorf("not found")
ErrNotConfigurable = errNotFoundBase.Errorf("not configurable")
ErrBaseInvalidOAuthConfig = errutil.ValidationFailed("sso.invalidOauthConfig")
ErrInvalidOAuthConfig = func(msg string) error {
base := ErrBaseInvalidOAuthConfig.Errorf("OAuth settings are invalid")
base.PublicMessage = msg
return base
}
ErrInvalidProvider = errutil.ValidationFailed("sso.invalidProvider", errutil.WithPublicMessage("Provider is invalid"))
ErrInvalidSettings = errutil.ValidationFailed("sso.settings", errutil.WithPublicMessage("Settings field is invalid"))
ErrEmptyClientId = errutil.ValidationFailed("sso.emptyClientId", errutil.WithPublicMessage("ClientId cannot be empty"))
)