Skip to content

Commit

Permalink
vouch#309 populate Sub from Username if blank
Browse files Browse the repository at this point in the history
  • Loading branch information
bnfinet committed Dec 7, 2020
1 parent 487def0 commit 79ff50c
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions pkg/structs/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ func (u *User) PrepareUserData() {
if u.Username == "" {
u.Username = u.Email
}
if u.Sub == "" {
u.Sub = u.Username
}
}

// AzureUser is a retrieved and authenticated user from Azure AD
Expand All @@ -58,27 +61,6 @@ func (u *AzureUser) PrepareUserData() {
}
}

// GoogleUser is a retrieved and authentiacted user from Google.
// unused!
// TODO: see if these should be pointers to the *User object as per
// https://golang.org/doc/effective_go.html#embedding
type GoogleUser struct {
User
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
Profile string `json:"profile"`
Picture string `json:"picture"`
EmailVerified bool `json:"email_verified"`
Gender string `json:"gender"`
HostDomain string `json:"hd"`
// jwt.StandardClaims
}

// PrepareUserData implement PersonalData interface
func (u *GoogleUser) PrepareUserData() {
u.Username = u.Email
}

// ADFSUser Active Directory user record
type ADFSUser struct {
User
Expand Down

0 comments on commit 79ff50c

Please sign in to comment.