auth
auth/doc.go
Use postgres arrays for scope associations. Use the new pqarrays library I wrote to store Scope associations for Tokens and AuthorizationCodes, instead of using our hacky and abstraction-breaking many-to-many code. We also created the authStore.deleteAuthorizationCodesByProfileID method, to clear out the AuthorizationCodes that belong to a Profile (used when the Profile is deleted). So we added the implementation for memstore and for our postgres store. Call Context.DeleteAuthorizationCodesByProfileID when deleting a Profile to clean up after it. Rename sortedScopes to Scopes, which we use pqarrays.StringArray's methods on to fulfill the sql.Scanner and driver.Valuer interfaces. This lets us store Scopes in postgres arrays. Create a stringsToScopes helper function that creates Scope objects, with their IDs filled by the strings specified. Update our GrantType.Validate function signature to return Scopes instead of []string. Create a Scopes.Strings() helper method that returns a []string of the IDs of the Scopes. Update our SQL init file to use the new postgres array definition, instead of the many-to-many definition.
| paddy@57 | 1 /* |
| paddy@57 | 2 Package auth provides an authentication service for managing user accounts and an OAuth2 provider. |
| paddy@57 | 3 |
| paddy@57 | 4 The service is an opinionated implementation of authentication using passphrases and the |
| paddy@57 | 5 code.secondbit.org/pass package to implement user credentials and accounts. Additionally, users |
| paddy@158 | 6 are permitted to login using any email address they have on record. Care is also taken to be able |
| paddy@158 | 7 to mitigate attacks that have already happened and plan ahead for the worst case scenarios. |
| paddy@57 | 8 |
| paddy@57 | 9 An OAuth2 provider is also built-in and provided, complete with client registration and management, |
| paddy@57 | 10 as well as a specification-based set of handlers for managing the issuing of grants and tokens. Token |
| paddy@57 | 11 validiity may be asserted through an API, or a proxy service is provided for stripping auth-specific |
| paddy@57 | 12 information from requests and replacing it with a trusted header containing information about the user |
| paddy@57 | 13 and client that authorized the request. |
| paddy@57 | 14 */ |
| paddy@57 | 15 package auth |