mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
parent
394ae369a1
commit
d31245fbba
2 changed files with 5 additions and 2 deletions
|
@ -27,6 +27,9 @@ func (a *Authorize) IsAuthorized(ctx context.Context, in *authorize.IsAuthorized
|
||||||
URL: getFullURL(in.GetRequestUrl(), in.GetRequestHost()),
|
URL: getFullURL(in.GetRequestUrl(), in.GetRequestHost()),
|
||||||
}
|
}
|
||||||
reply, err := a.pe.IsAuthorized(ctx, req)
|
reply, err := a.pe.IsAuthorized(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
log.Info().
|
log.Info().
|
||||||
// request
|
// request
|
||||||
Str("method", req.Method).
|
Str("method", req.Method).
|
||||||
|
@ -38,7 +41,7 @@ func (a *Authorize) IsAuthorized(ctx context.Context, in *authorize.IsAuthorized
|
||||||
Str("email", reply.Email).
|
Str("email", reply.Email).
|
||||||
Strs("groups", reply.Groups).
|
Strs("groups", reply.Groups).
|
||||||
Msg("authorize.grpc.IsAuthorized")
|
Msg("authorize.grpc.IsAuthorized")
|
||||||
return reply, err
|
return reply, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type protoHeader map[string]*authorize.IsAuthorizedRequest_Headers
|
type protoHeader map[string]*authorize.IsAuthorizedRequest_Headers
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestAuthorize_IsAuthorized(t *testing.T) {
|
||||||
wantErr bool
|
wantErr bool
|
||||||
}{
|
}{
|
||||||
{"good", &authorize.IsAuthorizedReply{}, nil, context.TODO(), &authorize.IsAuthorizedRequest{UserToken: "good"}, &authorize.IsAuthorizedReply{}, false},
|
{"good", &authorize.IsAuthorizedReply{}, nil, context.TODO(), &authorize.IsAuthorizedRequest{UserToken: "good"}, &authorize.IsAuthorizedReply{}, false},
|
||||||
{"error", &authorize.IsAuthorizedReply{}, errors.New("error"), context.TODO(), &authorize.IsAuthorizedRequest{UserToken: "good"}, &authorize.IsAuthorizedReply{}, true},
|
{"error", &authorize.IsAuthorizedReply{}, errors.New("error"), context.TODO(), &authorize.IsAuthorizedRequest{UserToken: "good"}, nil, true},
|
||||||
{"headers", &authorize.IsAuthorizedReply{}, nil, context.TODO(), &authorize.IsAuthorizedRequest{UserToken: "good", RequestHeaders: nil}, &authorize.IsAuthorizedReply{}, false},
|
{"headers", &authorize.IsAuthorizedReply{}, nil, context.TODO(), &authorize.IsAuthorizedRequest{UserToken: "good", RequestHeaders: nil}, &authorize.IsAuthorizedReply{}, false},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|
Loading…
Add table
Reference in a new issue