aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorzeripath2023-03-10 06:14:43 +0000
committerGitHub2023-03-10 01:14:43 -0500
commitdad057b6393548ad389ead07c2cce5b3ac2811e0 (patch)
tree9c2428b187001d7ad5460e9913eb2cae1124182d /services
parentf92e0a4018ca65936c95ac119c57d4b9ab62bc2d (diff)
Handle OpenID discovery URL errors a little nicer when creating/editing sources (#23397)
When there is an error creating a new openIDConnect authentication source try to handle the error a little better. Close #23283 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'services')
-rw-r--r--services/auth/source/oauth2/source_register.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/auth/source/oauth2/source_register.go b/services/auth/source/oauth2/source_register.go
index 3527d54b6..82a36acaa 100644
--- a/services/auth/source/oauth2/source_register.go
+++ b/services/auth/source/oauth2/source_register.go
@@ -36,6 +36,10 @@ func (err ErrOpenIDConnectInitialize) Error() string {
return fmt.Sprintf("Failed to initialize OpenID Connect Provider with name '%s' with url '%s': %v", err.ProviderName, err.OpenIDConnectAutoDiscoveryURL, err.Cause)
}
+func (err ErrOpenIDConnectInitialize) Unwrap() error {
+ return err.Cause
+}
+
// wrapOpenIDConnectInitializeError is used to wrap the error but this cannot be done in modules/auth/oauth2
// inside oauth2: import cycle not allowed models -> modules/auth/oauth2 -> models
func wrapOpenIDConnectInitializeError(err error, providerName string, source *Source) error {