mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-06 16:36:51 +00:00
fix(handler/reverseproxy): only trigger acr step up for non-ignored autologin paths
This commit is contained in:
@@ -21,8 +21,8 @@ type AutoLogin struct {
|
||||
cache sync.Map
|
||||
}
|
||||
|
||||
func (a *AutoLogin) NeedsLogin(r *http.Request, isAuthenticated bool) bool {
|
||||
if isAuthenticated || !a.Enabled || r.Method != http.MethodGet {
|
||||
func (a *AutoLogin) NeedsLogin(r *http.Request, isAuthenticated, isAcrValid bool) bool {
|
||||
if (isAuthenticated && isAcrValid) || !a.Enabled || r.Method != http.MethodGet {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -84,13 +84,14 @@ func (rp *ReverseProxy) Handler(src ReverseProxySource, w http.ResponseWriter, r
|
||||
logger.Errorf("default: unauthenticated: unexpected error: %+v", err)
|
||||
}
|
||||
|
||||
isAcrValid := true
|
||||
err = src.GetAcrHandler().Validate(sess)
|
||||
if err != nil {
|
||||
loginRedirect(src, w, r, err.Error())
|
||||
return
|
||||
isAcrValid = false
|
||||
logger.Infof("default: acr: %+v; checking for autologin...", err)
|
||||
}
|
||||
|
||||
if src.GetAutoLogin().NeedsLogin(r, isAuthenticated) {
|
||||
if src.GetAutoLogin().NeedsLogin(r, isAuthenticated, isAcrValid) {
|
||||
loginRedirect(src, w, r, "request matches autologin")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user