SignIn serves a page prompting users to sign in
(rw http.ResponseWriter, req *http.Request)
| 688 | |
| 689 | // SignIn serves a page prompting users to sign in |
| 690 | func (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 |
| 719 | func (p *OAuthProxy) UserInfo(rw http.ResponseWriter, req *http.Request) { |
nothing calls this directly
no test coverage detected