auth
auth/profile.go
Clean up sessions and tokens after Profile is deleted. Add a terminateSessionsByProfile method to our sessionStore to mark Sessions associated with a Profile as inactive. Implement memstore and postgres implementations of the terminateSessionsByProfile method. Add a TerminateSessionsByProfile wrapper method to Context. Add a revokeTokensByProfileID method to our tokenStore to mark Tokens associated with a Profile as revoked. Implement memstore and postgres implementation of the revokeTokensByProfileID method. Add a RevokeTokensByProfileID wrapper method to Context. Call our RevokeTokensByProfileID and TerminateSessionsByProfile methods after a Profile is deleted, to clean up the Tokens and Sessions associated with it.
1.1 --- a/profile.go Sat Apr 11 17:58:15 2015 -0400 1.2 +++ b/profile.go Sat Apr 11 19:07:26 2015 -0400 1.3 @@ -432,9 +432,16 @@ 1.4 if err != nil { 1.5 log.Printf("Error removing logins from profile %s: %+v\n", profile, err) 1.6 } 1.7 - // BUG(paddy): need to terminate all sessions associated with the Profile 1.8 - // BUG(paddy): need to invalidate all tokens associated with the Profile 1.9 + err = context.TerminateSessionsByProfile(profile) 1.10 + if err != nil { 1.11 + log.Printf("Error terminating sessions associated with profile %s: %+v\n", profile, err) 1.12 + } 1.13 + err = context.RevokeTokensByProfileID(profile) 1.14 + if err != nil { 1.15 + log.Printf("Error revoking tokens associated with profile %s: %+v\n", profile, err) 1.16 + } 1.17 // BUG(paddy): need to delete all the grants associated with the Profile 1.18 + // BUG(paddy): need to delete all clients associated with the Profile 1.19 } 1.20 1.21 // RegisterProfileHandlers adds handlers to the passed router to handle the profile endpoints, like registration and user retrieval.