auth

Paddy 2015-01-18 Parent:0a1e16b9c141 Child:d30a3a12d387

124:d14f0a81498c Go to Latest

auth/authcode.go

Fill out token.CreatedFrom. Add a GrantType.AuditString() string method that will return a string for an audit log. Basically, it returns enough information to identify how the token got created. For client credentials, that's just the string "client_credentials". For user credentials, that's just the string "credentials". For auth codes, that's "authcode:", followed by the code used. For refresh tokens, that's "refresh_token:", followed by the refresh token used.

History
     1.1 --- a/authcode.go	Sun Jan 18 04:54:02 2015 -0500
     1.2 +++ b/authcode.go	Sun Jan 18 05:03:17 2015 -0500
     1.3 @@ -16,6 +16,7 @@
     1.4  		IssuesRefresh: true,
     1.5  		ReturnToken:   RenderJSONToken,
     1.6  		AllowsPublic:  true,
     1.7 +		AuditString:   authCodeGrantAuditString,
     1.8  	})
     1.9  }
    1.10  
    1.11 @@ -138,3 +139,7 @@
    1.12  	}
    1.13  	return context.UseAuthorizationCode(code)
    1.14  }
    1.15 +
    1.16 +func authCodeGrantAuditString(r *http.Request) string {
    1.17 +	return "authcode:" + r.PostFormValue("code")
    1.18 +}