mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-04 12:56:02 +02:00
authorize: add redirect url to debug page (#1533)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
3dec1edf00
commit
c85b45cff6
1 changed files with 19 additions and 2 deletions
|
@ -58,15 +58,32 @@ func (a *Authorize) deniedResponse(
|
||||||
}
|
}
|
||||||
|
|
||||||
if returnHTMLError {
|
if returnHTMLError {
|
||||||
return a.htmlDeniedResponse(code, reason, headers)
|
return a.htmlDeniedResponse(in, code, reason, headers)
|
||||||
}
|
}
|
||||||
return a.plainTextDeniedResponse(code, reason, headers)
|
return a.plainTextDeniedResponse(code, reason, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Authorize) htmlDeniedResponse(code int32, reason string, headers map[string]string) *envoy_service_auth_v2.CheckResponse {
|
func (a *Authorize) htmlDeniedResponse(
|
||||||
|
in *envoy_service_auth_v2.CheckRequest,
|
||||||
|
code int32, reason string, headers map[string]string,
|
||||||
|
) *envoy_service_auth_v2.CheckResponse {
|
||||||
|
|
||||||
opts := a.currentOptions.Load()
|
opts := a.currentOptions.Load()
|
||||||
debugEndpoint := opts.GetAuthenticateURL().ResolveReference(&url.URL{Path: "/.pomerium/"})
|
debugEndpoint := opts.GetAuthenticateURL().ResolveReference(&url.URL{Path: "/.pomerium/"})
|
||||||
|
|
||||||
|
// create go-style http request
|
||||||
|
r := getHTTPRequestFromCheckRequest(in)
|
||||||
|
redirectURL := urlutil.GetAbsoluteURL(r).String()
|
||||||
|
if ref := r.Header.Get(httputil.HeaderReferrer); ref != "" {
|
||||||
|
redirectURL = ref
|
||||||
|
}
|
||||||
|
|
||||||
|
debugEndpoint = debugEndpoint.ResolveReference(&url.URL{
|
||||||
|
RawQuery: url.Values{
|
||||||
|
urlutil.QueryRedirectURI: {redirectURL},
|
||||||
|
}.Encode(),
|
||||||
|
})
|
||||||
|
|
||||||
var details string
|
var details string
|
||||||
switch code {
|
switch code {
|
||||||
case httputil.StatusInvalidClientCertificate:
|
case httputil.StatusInvalidClientCertificate:
|
||||||
|
|
Loading…
Add table
Reference in a new issue