Skip to content

Commit 8a27d93

Browse files
author
Yohan Lascombe
committed
fix: try to better manage internal server error when user not granted
1 parent 3045392 commit 8a27d93

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

oauthproxy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,12 @@ func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request) {
886886

887887
err = p.enrichSessionState(req.Context(), session)
888888
if err != nil {
889+
fmt.Printf(err.Error())
890+
if err.Error() == "user is missing required team" {
891+
logger.PrintAuthf(session.Email, req, logger.AuthFailure, "Invalid authentication via OAuth2: unauthorized. User is missing required team")
892+
p.ErrorPage(rw, req, http.StatusForbidden, "Invalid authentication: user is missing required team")
893+
return
894+
}
889895
logger.Errorf("Error creating session during OAuth2 callback: %v", err)
890896
p.ErrorPage(rw, req, http.StatusInternalServerError, err.Error())
891897
return

0 commit comments

Comments
 (0)