mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-12 08:37:38 +02:00
envoy: forward claim and assertion headers (#739)
This commit is contained in:
parent
2275bb8ad4
commit
f40fb3d2ea
2 changed files with 5 additions and 2 deletions
|
@ -117,7 +117,7 @@ func (p *Proxy) Verify(verifyOnly bool) http.Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
original := p.getOriginalRequest(r, uri)
|
original := p.getOriginalRequest(r, uri)
|
||||||
authorized, err := p.isAuthorized(original)
|
authorized, err := p.isAuthorized(w, original)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return httputil.NewError(http.StatusBadRequest, err)
|
return httputil.NewError(http.StatusBadRequest, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (p *Proxy) redirectToSignin(w http.ResponseWriter, r *http.Request) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Proxy) isAuthorized(r *http.Request) (bool, error) {
|
func (p *Proxy) isAuthorized(w http.ResponseWriter, r *http.Request) (bool, error) {
|
||||||
tm, err := ptypes.TimestampProto(time.Now())
|
tm, err := ptypes.TimestampProto(time.Now())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, httputil.NewError(http.StatusInternalServerError, fmt.Errorf("error creating protobuf timestamp from current time: %w", err))
|
return false, httputil.NewError(http.StatusInternalServerError, fmt.Errorf("error creating protobuf timestamp from current time: %w", err))
|
||||||
|
@ -81,6 +81,9 @@ func (p *Proxy) isAuthorized(r *http.Request) (bool, error) {
|
||||||
|
|
||||||
switch res.HttpResponse.(type) {
|
switch res.HttpResponse.(type) {
|
||||||
case *envoy_service_auth_v2.CheckResponse_OkResponse:
|
case *envoy_service_auth_v2.CheckResponse_OkResponse:
|
||||||
|
for _, hdr := range res.GetOkResponse().GetHeaders() {
|
||||||
|
w.Header().Set(hdr.GetHeader().GetKey(), hdr.GetHeader().GetValue())
|
||||||
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
default:
|
default:
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue