auth

Paddy 2014-12-13 Parent:1fb166575e69 Child:d5561856f45e

88:61a802849b51 Go to Latest

auth/oauth2.go

Add refresh expiration and revoking tokens. Add a property to hold the expiration date for a refresh token. Add a TODO for a tokenStore method to revoke a token.

History
     1.1 --- a/oauth2.go	Sun Dec 07 03:40:25 2014 -0500
     1.2 +++ b/oauth2.go	Sat Dec 13 19:05:06 2014 -0500
     1.3 @@ -399,13 +399,14 @@
     1.4  		refresh = uuid.NewID().String()
     1.5  	}
     1.6  	token := Token{
     1.7 -		AccessToken:  uuid.NewID().String(),
     1.8 -		RefreshToken: refresh,
     1.9 -		Created:      time.Now(),
    1.10 -		ExpiresIn:    defaultTokenExpiration,
    1.11 -		TokenType:    "bearer",
    1.12 -		Scope:        scope,
    1.13 -		ProfileID:    profileID,
    1.14 +		AccessToken:      uuid.NewID().String(),
    1.15 +		RefreshToken:     refresh,
    1.16 +		Created:          time.Now(),
    1.17 +		ExpiresIn:        defaultTokenExpiration,
    1.18 +		RefreshExpiresIn: defaultRefreshTokenExpiration,
    1.19 +		TokenType:        "bearer",
    1.20 +		Scope:            scope,
    1.21 +		ProfileID:        profileID,
    1.22  	}
    1.23  	err := context.SaveToken(token)
    1.24  	if err != nil {