auth

Paddy 2014-12-13 Parent:a22b35677cd5 Child:e57a57a944c4

94:9c50b2e2e03b Go to Latest

auth/context.go

Implement invalidating AuthorizationCodes once used. Add a Used property to AuthorizationCodes, which is set to true in the Invalidate function of the AuthorizationCode GrantType. Implement a useAuthorizationCode function for the memstore. Add useAuthorizzationCode to the authorizationCodeStore interface.

History
     1.1 --- a/context.go	Sat Dec 13 19:24:31 2014 -0500
     1.2 +++ b/context.go	Sat Dec 13 19:38:56 2014 -0500
     1.3 @@ -155,6 +155,15 @@
     1.4  	return c.authCodes.deleteAuthorizationCode(code)
     1.5  }
     1.6  
     1.7 +// UseAuthorizationCode marks the AuthorizationCode specified by the provided code as used in the authorizationCodeStore associated with
     1.8 +// the Context. Once an AuthorizationCode is marked as used, its Used property will be set to true when retrieved from the authorizationCodeStore.
     1.9 +func (c Context) UseAuthorizationCode(code string) error {
    1.10 +	if c.authCodes == nil {
    1.11 +		return ErrNoAuthorizationCodeStore
    1.12 +	}
    1.13 +	return c.authCodes.useAuthorizationCode(code)
    1.14 +}
    1.15 +
    1.16  // GetProfileByID returns the Profile specified by the provided ID from the profileStore associated with
    1.17  // the Context.
    1.18  func (c Context) GetProfileByID(id uuid.ID) (Profile, error) {