mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
authorize: add name claim (#3238)
This commit is contained in:
parent
6914fb8abf
commit
d299b42509
2 changed files with 16 additions and 1 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
|
||||
"github.com/pomerium/pomerium/config"
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
|
@ -81,7 +82,11 @@ func TestHeadersEvaluator(t *testing.T) {
|
|||
output, err := eval(t,
|
||||
[]proto.Message{
|
||||
&session.Session{Id: "s1", ImpersonateSessionId: proto.String("s2"), UserId: "u1"},
|
||||
&session.Session{Id: "s2", UserId: "u2"},
|
||||
&session.Session{Id: "s2", UserId: "u2", Claims: map[string]*structpb.ListValue{
|
||||
"name": {Values: []*structpb.Value{
|
||||
structpb.NewStringValue("n1"),
|
||||
}},
|
||||
}},
|
||||
},
|
||||
&HeadersRequest{
|
||||
FromAudience: "from.example.com",
|
||||
|
@ -105,6 +110,7 @@ func TestHeadersEvaluator(t *testing.T) {
|
|||
assert.Equal(t, "s1", claims["sid"], "should set session id to input session id")
|
||||
assert.Equal(t, "u2", claims["sub"], "should set subject to user id")
|
||||
assert.Equal(t, "u2", claims["user"], "should set user to user id")
|
||||
assert.Equal(t, "n1", claims["name"], "should set name")
|
||||
})
|
||||
|
||||
t.Run("access token", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue