fix: provide more information in the retrieve idp information (#5927)

* fix: provide more information in the retrieve idp information

* change raw_information to proto struct

* change unmarshal

* improve description
This commit is contained in:
Livio Spring
2023-06-20 14:39:50 +02:00
committed by GitHub
parent 83da9cada7
commit 1017568cf1
9 changed files with 169 additions and 52 deletions

View File

@@ -439,7 +439,9 @@ func TestCommands_SucceedIDPIntent(t *testing.T) {
event, _ := idpintent.NewSucceededEvent(
context.Background(),
&idpintent.NewAggregate("id", "ro").Aggregate,
[]byte(`{"RawInfo":{"id":"id"}}`),
[]byte(`{"sub":"id","preferred_username":"username"}`),
"id",
"username",
"",
&crypto.CryptoValue{
CryptoType: crypto.TypeEncryption,
@@ -447,7 +449,7 @@ func TestCommands_SucceedIDPIntent(t *testing.T) {
KeyID: "id",
Crypted: []byte("accessToken"),
},
"",
"idToken",
)
return event
}(),
@@ -458,18 +460,20 @@ func TestCommands_SucceedIDPIntent(t *testing.T) {
args{
ctx: context.Background(),
writeModel: NewIDPIntentWriteModel("id", "ro"),
idpSession: &oauth.Session{
idpSession: &openid.Session{
Tokens: &oidc.Tokens[*oidc.IDTokenClaims]{
Token: &oauth2.Token{
AccessToken: "accessToken",
},
IDToken: "idToken",
},
},
idpUser: &oauth.UserMapper{
RawInfo: map[string]interface{}{
"id": "id",
idpUser: openid.NewUser(&oidc.UserInfo{
Subject: "id",
UserInfoProfile: oidc.UserInfoProfile{
PreferredUsername: "username",
},
},
}),
},
res{
token: "aWQ",