Merge pull request #208 from desimone/feature/add-login-redirect-on-internal-urls

proxy: add auth redirect to internal urls
This commit is contained in:
Bobby DeSimone 2019-07-06 11:46:50 -07:00 committed by GitHub
commit 79f96eab52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -17,6 +17,7 @@
- Fixed HEADERS environment variable parsing [GH-188] - Fixed HEADERS environment variable parsing [GH-188]
- Fixed Azure group lookups [GH-190] - Fixed Azure group lookups [GH-190]
- If a session is too large (over 4096 bytes) Pomerium will no longer fail silently. [GH-211] - If a session is too large (over 4096 bytes) Pomerium will no longer fail silently. [GH-211]
- Internal URLs like dashboard now start auth process to login a user if no session is found [GH-205].
## v0.0.5 ## v0.0.5

View file

@ -289,9 +289,9 @@ func (p *Proxy) Proxy(w http.ResponseWriter, r *http.Request) {
func (p *Proxy) UserDashboard(w http.ResponseWriter, r *http.Request) { func (p *Proxy) UserDashboard(w http.ResponseWriter, r *http.Request) {
session, err := p.sessionStore.LoadSession(r) session, err := p.sessionStore.LoadSession(r)
if err != nil { if err != nil {
log.FromRequest(r).Error().Err(err).Msg("proxy: load session failed") log.FromRequest(r).Debug().Str("cause", err.Error()).Msg("proxy: no session, redirecting to auth")
httpErr := &httputil.Error{Message: err.Error(), Code: http.StatusBadRequest} p.sessionStore.ClearSession(w, r)
httputil.ErrorResponse(w, r, httpErr) p.OAuthStart(w, r)
return return
} }