Skip to content

Commit 791404c

Browse files
committed
misc
1 parent 41a8d02 commit 791404c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

internal/auth/authenticator.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,13 +583,12 @@ func (p *Authenticator) getOAuthCallback(rw http.ResponseWriter, req *http.Reque
583583
if len(errors) != 0 {
584584
tags := append(tags, "error:invalid_email")
585585
p.StatsdClient.Incr("application_error", tags, 1.0)
586-
logger.WithUser(session.Email).Info(
586+
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).Info(
587587
fmt.Sprintf("oauth callback: unauthorized: %q", errors))
588588
return "", HTTPError{Code: http.StatusForbidden, Message: "Invalid Account"}
589589
}
590-
591590
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).Info(
592-
fmt.Sprintf("oauth callbackr user passed validation"))
591+
fmt.Sprintf("oauth callback: user passed validation"))
593592

594593
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).Info("authentication complete")
595594
err = p.sessionStore.SaveSession(rw, req, session)

internal/proxy/oauthproxy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ type OAuthProxy struct {
7070
publicCertsJSON []byte
7171

7272
// these are required
73-
cookieCipher aead.Cipher
7473
provider providers.Provider
74+
cookieCipher aead.Cipher
7575
upstreamConfig *UpstreamConfig
7676
handler http.Handler
7777
csrfStore sessions.CSRFStore
@@ -575,12 +575,13 @@ func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request) {
575575
p.StatsdClient.Incr("application_error", tags, 1.0)
576576
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).Info(
577577
fmt.Sprintf("permission denied: unauthorized: %q", errors))
578+
// TODO: As is, the error page given to users provides no extra contract around what failed.
578579
p.ErrorPage(rw, req, http.StatusForbidden, "Permission Denied", "Account Validation Error")
579580
return
580581
}
581582

582-
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).Info(
583-
fmt.Sprintf("oauth callback: user passed validation"))
583+
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).WithInGroups(session.Groups).Info(
584+
fmt.Sprintf("oauth callback: user validated "))
584585

585586
// We store the session in a cookie and redirect the user back to the application
586587
err = p.sessionStore.SaveSession(rw, req, session)
@@ -597,7 +598,6 @@ func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request) {
597598

598599
// This is the redirect back to the original requested application
599600
http.Redirect(rw, req, stateParameter.RedirectURI, http.StatusFound)
600-
601601
}
602602

603603
// AuthenticateOnly calls the Authenticate handler.
@@ -782,7 +782,7 @@ func (p *OAuthProxy) Authenticate(rw http.ResponseWriter, req *http.Request) (er
782782
}
783783

784784
logger.WithRemoteAddress(remoteAddr).WithUser(session.Email).Info(
785-
fmt.Sprintf("authentication: user passed validation"))
785+
fmt.Sprintf("authentication: user validated"))
786786

787787
for key, val := range p.upstreamConfig.InjectRequestHeaders {
788788
req.Header.Set(key, val)

internal/proxy/providers/sso.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ func (p *SSOProvider) Redeem(redirectURL, code string) (*sessions.SessionState,
177177
// an authorized group.
178178
func (p *SSOProvider) ValidateGroup(email string, allowedGroups []string, accessToken string) ([]string, bool, error) {
179179
logger := log.NewLogEntry()
180+
180181
logger.WithUser(email).WithAllowedGroups(allowedGroups).Info("validating groups")
181182
inGroups := []string{}
182183
if len(allowedGroups) == 0 {

0 commit comments

Comments
 (0)