mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-04 11:52:53 +02:00
authorize: implement allowed_idp_claims (#1542)
* add arbitrary claims to session * add support for maps * update flattened claims * fix eol * fix trailing whitespace * fix tests
This commit is contained in:
parent
2a97e92d50
commit
153e438eb6
24 changed files with 1369 additions and 743 deletions
|
@ -4,28 +4,21 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
"github.com/pomerium/pomerium/pkg/grpc/user"
|
||||
)
|
||||
|
||||
func TestScrubber(t *testing.T) {
|
||||
s := NewScrubber("pomerium").Whitelist("user.User", "version", "id")
|
||||
c1, _ := anypb.New(wrapperspb.String("claim1"))
|
||||
u := s.ScrubProto(&user.User{
|
||||
Version: "v1",
|
||||
Id: "u1",
|
||||
Name: "name1",
|
||||
Email: "user@example.com",
|
||||
Claims: map[string]*anypb.Any{
|
||||
"key1": c1,
|
||||
},
|
||||
}).(*user.User)
|
||||
|
||||
assert.Equal(t, "v1", u.Version)
|
||||
assert.Equal(t, "u1", u.Id)
|
||||
assert.Equal(t, s.hmacString("name1"), u.Name)
|
||||
assert.Equal(t, s.hmacString("user@example.com"), u.Email)
|
||||
assert.Equal(t, s.hmacString("claim1"), u.GetClaim("key1"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue