auth
auth/oauth2.go
Log ignored errors, grant revocations can return an error. Turn a few TODOs for logging errors into calls to log the actual error. Change the return type of grant revocations for GrantTypes to an error, so they can be logged by the system, not each GrantType. Implement a stub of the revocation function for the authcode GrantType.
1.1 --- a/oauth2.go Sat Dec 13 19:11:38 2014 -0500 1.2 +++ b/oauth2.go Sat Dec 13 19:16:57 2014 -0500 1.3 @@ -63,7 +63,7 @@ 1.4 // was successfully returned and the Invalidate function will be called asynchronously. 1.5 type GrantType struct { 1.6 Validate func(w http.ResponseWriter, r *http.Request, context Context) (scope string, profileID uuid.ID, valid bool) 1.7 - Invalidate func(r *http.Request, context Context) bool 1.8 + Invalidate func(r *http.Request, context Context) error 1.9 ReturnToken func(w http.ResponseWriter, r *http.Request, token Token, context Context) bool 1.10 IssuesRefresh bool 1.11 } 1.12 @@ -107,7 +107,7 @@ 1.13 Error: errorType, 1.14 }) 1.15 if err != nil { 1.16 - // TODO(paddy): log this or something 1.17 + log.Println(err) 1.18 } 1.19 } 1.20 1.21 @@ -123,7 +123,7 @@ 1.22 } 1.23 err := enc.Encode(resp) 1.24 if err != nil { 1.25 - // TODO(paddy): log this or something 1.26 + log.Println(err) 1.27 return false 1.28 } 1.29 return true