Skip to content

Commit

Permalink
Add profileData key to UserIdentity
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwarshaw committed Mar 7, 2022
1 parent 7d73f02 commit fadfbd3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
15 changes: 8 additions & 7 deletions management/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,14 @@ type UserIdentityLink struct {

// UserIdentity holds values that validate a User's identity.
type UserIdentity struct {
Connection *string `json:"connection,omitempty"`
UserID *string `json:"-"`
Provider *string `json:"provider,omitempty"`
IsSocial *bool `json:"isSocial,omitempty"`
AccessToken *string `json:"access_token,omitempty"`
AccessTokenSecret *string `json:"access_token_secret,omitempty"`
RefreshToken *string `json:"refresh_token,omitempty"`
Connection *string `json:"connection,omitempty"`
UserID *string `json:"-"`
Provider *string `json:"provider,omitempty"`
IsSocial *bool `json:"isSocial,omitempty"`
AccessToken *string `json:"access_token,omitempty"`
AccessTokenSecret *string `json:"access_token_secret,omitempty"`
RefreshToken *string `json:"refresh_token,omitempty"`
ProfileData *map[string]interface{} `json:"profileData,omitempty"`
}

// UnmarshalJSON is a custom deserializer for the UserIdentity type.
Expand Down
10 changes: 10 additions & 0 deletions management/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,5 +400,15 @@ func TestUserIdentity(t *testing.T) {
}
expect.Expect(t, u.GetUserID(), expected.GetUserID())
}

profileData := map[string]interface{}{"picture": "some-picture.jpeg"}
b := `{"profileData": {"picture": "some-picture.jpeg"}}`
expected := &UserIdentity{ProfileData: &profileData}
var u UserIdentity
err := json.Unmarshal([]byte(b), &u)
if err != nil {
t.Error(err)
}
expect.Expect(t, u.ProfileData, expected.ProfileData)
})
}

0 comments on commit fadfbd3

Please sign in to comment.