Created
May 26, 2017 14:29
-
-
Save Riduidel/6b03ac870ae5c1d28102da10782ab9f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func (h *handler) checkAuth(context *db.DatabaseContext) error { | |
| h.user = nil | |
| if context == nil { | |
| return nil | |
| } | |
| defer checkAuthRollingMean.AddSince(time.Now()) | |
| var err error | |
| // If oidc enabled, check for bearer ID token | |
| if context.Options.OIDCOptions != nil { | |
| if token := h.getBearerToken(); token != "" { | |
| h.user, _, err = context.Authenticator().AuthenticateUntrustedJWT(token, context.OIDCProviders, h.getOIDCCallbackURL) | |
| if h.user == nil || err != nil { | |
| return base.HTTPErrorf(http.StatusUnauthorized, "Invalid login") | |
| } | |
| return nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment