@@ -646,14 +646,14 @@ func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request) {
646646// AuthenticateOnly checks whether the user is currently logged in
647647func (p *OAuthProxy) AuthenticateOnly(rw http.ResponseWriter, req *http.Request) {
648648 session, err := p.getAuthenticatedSession(rw, req)
649− switch err {
650− case nil:
651− // we are authenticated
652− p.addHeadersForProxying(rw, req, session)
653− rw.WriteHeader(http.StatusAccepted)
654− default:
649+ if err != nil {
655650 http.Error(rw, "unauthorized request", http.StatusUnauthorized)
651+ return
656652 }
653+
654+ // we are authenticated
655+ p.addHeadersForProxying(rw, req, session)
656+ rw.WriteHeader(http.StatusAccepted)
657657}
658658
659659// Proxy proxies the user request if the user is authenticated else it prompts