You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// authHandler - does the authentication for the routesfuncauthHandler(h http.Handler, providers []auth.Provider) http.Handler {
returnhttp.HandlerFunc(func(w http.ResponseWriter, r*http.Request) {
varprincipalFounderrorfor_, provider:=rangeproviders {
principal, err:=provider.GetPrincipal(r)
ifprincipal!=nil {
log.Debug("We found one. HOORAY!")
// we found our principal, stop lookingbreak
}
iferr!=nil {
principalFound=err
}
}
// if we went through the providers and found no principals. We will// have found an errorifprincipalFound!=nil {
log.Debug("no principal found")
writeResponse(w, http.StatusUnauthorized, broker.ErrorResponse{Description: principalFound.Error()})
return
}
h.ServeHTTP(w, r)
})
}
The text was updated successfully, but these errors were encountered:
There are times we will want to add an auth handler or other http handler middleware to allow for authentication before accessing the broker.
https://github.com/openshift/ansible-service-broker/blob/master/pkg/handler/handler.go#L196
The text was updated successfully, but these errors were encountered: