mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 02:46:30 +02:00
* add arbitrary claims to session * add support for maps * update flattened claims * fix eol * fix trailing whitespace * fix tests
28 lines
434 B
Go
28 lines
434 B
Go
package identity
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestClaims_Flatten(t *testing.T) {
|
|
var claims Claims
|
|
_ = json.Unmarshal([]byte(`
|
|
{
|
|
"a": {
|
|
"aa": {
|
|
"aaa": 12345
|
|
},
|
|
"ab": [1, 2, 3, 4, 5]
|
|
}
|
|
}
|
|
`), &claims)
|
|
|
|
flattened := claims.Flatten()
|
|
assert.Equal(t, FlattenedClaims{
|
|
"a.aa.aaa": {12345.0},
|
|
"a.ab": {1.0, 2.0, 3.0, 4.0, 5.0},
|
|
}, flattened)
|
|
}
|