diff options
| author | Max Resnick <max@ofmax.li> | 2020-11-08 11:45:16 -0800 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2021-01-01 10:50:14 -0800 |
| commit | a397341ad471cc761f7fb930d77e53cf7eb40a2a (patch) | |
| tree | 76fb8318269569687fdd30467dc61ecba3499d09 /internal/auth/model.go | |
| parent | 689a57ec4a444f8233fe2e5ec7ceb0903218218d (diff) | |
| download | iserv-a397341ad471cc761f7fb930d77e53cf7eb40a2a.tar.gz | |
adds casbin and accounts
Diffstat (limited to '')
| -rw-r--r-- | internal/auth/model.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/internal/auth/model.go b/internal/auth/model.go index c51ff05..240b11b 100644 --- a/internal/auth/model.go +++ b/internal/auth/model.go @@ -6,20 +6,10 @@ import ( "golang.org/x/oauth2" ) -// GoogleAuthProfile auth'd user profile -// ProfileId, Email, Name, PictureURL -type GoogleAuthProfile struct { - ProfileID string `json:"sub"` - Email string `json:"email"` - Name string `json:"name"` - PictureURL string `json:"picture"` -} - // Profile profile and token // Identifier + Token type Profile struct { ID string `json:"sub"` - Email string `json:"email"` AccessToken string `json:"access_token"` TokenType string `json:"token_type,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` @@ -37,10 +27,9 @@ func (ap *Profile) Token() (*oauth2.Token, error) { } // NewAuthProfile merge token and profile -func NewAuthProfile(t *oauth2.Token, u *GoogleAuthProfile) *Profile { +func NewAuthProfile(t *oauth2.Token, id string) *Profile { return &Profile{ - u.ProfileID, - u.Email, + id, t.AccessToken, t.TokenType, t.RefreshToken, |