MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / SignIn

Method SignIn

oauthproxy.go:690–716  ·  view source on GitHub ↗

SignIn serves a page prompting users to sign in

(rw http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

688
689// SignIn serves a page prompting users to sign in
690func (p *OAuthProxy) SignIn(rw http.ResponseWriter, req *http.Request) {
691 redirect, err := p.appDirector.GetRedirect(req)
692 if err != nil {
693 logger.Errorf("Error obtaining redirect: %v", err)
694 p.ErrorPage(rw, req, http.StatusInternalServerError, err.Error())
695 return
696 }
697
698 user, ok, statusCode := p.ManualSignIn(req)
699 if ok {
700 session := &sessionsapi.SessionState{User: user, Groups: p.basicAuthGroups}
701 err = p.SaveSession(rw, req, session)
702 if err != nil {
703 logger.Printf("Error saving session: %v", err)
704 p.ErrorPage(rw, req, http.StatusInternalServerError, err.Error())
705 return
706 }
707 http.Redirect(rw, req, redirect, http.StatusFound)
708 } else {
709 if p.SkipProviderButton {
710 p.OAuthStart(rw, req)
711 } else {
712 // TODO - should we pass on /oauth2/sign_in query params to /oauth2/start?
713 p.SignInPage(rw, req, statusCode)
714 }
715 }
716}
717
718// UserInfo endpoint outputs session email and preferred username in JSON format
719func (p *OAuthProxy) UserInfo(rw http.ResponseWriter, req *http.Request) {

Callers

nothing calls this directly

Calls 9

ErrorPageMethod · 0.95
ManualSignInMethod · 0.95
SaveSessionMethod · 0.95
OAuthStartMethod · 0.95
SignInPageMethod · 0.95
ErrorfFunction · 0.92
PrintfFunction · 0.92
GetRedirectMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected