Skip to content

Commit

Permalink
Merge pull request #11 from plimble/add-user-id-in-token-grant-password
Browse files Browse the repository at this point in the history
add userID in accessToken
  • Loading branch information
witooh committed Jul 12, 2017
2 parents bc30a6b + 0da1d30 commit da410f3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions oauth2/token/grant_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (g *PassowrdGrantType) CreateToken(grantData *GrantData, client *oauth2.Cli
func (g *PassowrdGrantType) createAccessToken(grantData *GrantData, client *oauth2.Client, storage oauth2.Storage, tokenGen oauth2.TokenGenerator) (string, error) {
atoken, err := tokenGen.CreateAccessToken(&oauth2.CreateAccessTokenRequest{
ClientID: client.ID,
UserID: grantData.UserID,
Scopes: grantData.Scopes,
ExpiresIn: grantData.AccessTokenLifespan,
Extras: grantData.Extras,
Expand All @@ -77,6 +78,7 @@ func (g *PassowrdGrantType) createAccessToken(grantData *GrantData, client *oaut
at := &oauth2.AccessToken{
AccessToken: atoken,
ClientID: client.ID,
UserID: grantData.UserID,
Scopes: grantData.Scopes,
Expired: time.Now().UTC().Add(time.Second * time.Duration(grantData.AccessTokenLifespan)).Unix(),
ExpiresIn: grantData.AccessTokenLifespan,
Expand All @@ -96,6 +98,7 @@ func (g *PassowrdGrantType) createRefreshToken(grantData *GrantData, client *oau
rt := &oauth2.RefreshToken{
RefreshToken: rtoken,
ClientID: client.ID,
UserID: grantData.UserID,
Scopes: grantData.Scopes,
Expired: time.Now().UTC().Add(time.Second * time.Duration(grantData.RefreshTokenLifespan)).Unix(),
Extras: grantData.Extras,
Expand Down

0 comments on commit da410f3

Please sign in to comment.