# README
oauth2
This is a OAuth2 helper library.
This library implements osin storage with upper.io as storage layer. So it supports all storage that upper.io supports (i.e. MySQL, PostgreSQL, SQLite3, MongoDB).
Structs are defined to be as generic as possible. Data layer is generated with gourd and hence implementing the gourd's store interface.
# Functions
AccessDataStoreProvider implements store.Provider interface provides raw AccessDataStore.
AuthorizeDataStoreProvider implements store.Provider interface provides raw AuthorizeDataStore.
ClientStoreProvider implements store.Provider interface provides raw ClientStore.
DefaultOsinConfig returns a preset config suitable for most generic oauth2 usage.
DefaultStorage returns Storage that attachs to default stores.
GetAccess returns oauth2 AccessData stored in session.
GetToken reads the token from context.
LoadTokenAccess reads token information from header ("Authority") and, if AccessData found for the given token, add to context.
Middleware retrieves token from context with GetToken(), then set the AccessData to the context with WithAccess().
NewLoginFormFunc creates a LoginFormFunc from given template.
NewManager returns a oauth2 manager with default configs.
NewUserFunc creates the default parser of login HTTP request.
ReadScopes read a string and return scopes list.
Route adds manager's endpoint to a router with httpservice.RouterFunc.
SetErrorLogger setup the error logger for all oauth2 operations.
SetLogger setup the default logger for all oauth2 operations.
UserDataID reads UserData field for AccessData / AuthorizeData then retrieve the ID string or return error.
UserRest binds store to pat router.
UserStoreEndpoints return CURD endpoints for UserStore.
UserStoreProvider implements store.Provider interface provides raw UserStore.
No description provided by the author
UseToken reads the token information from header ("Authority") and add to the context.
WithAccess implements go-kit httptransport RequestFunc Adds the current HTTP Request to context.Context.
# Constants
DefaultLoginTpl is the HTML template for login form by default.
Keys for Storage to access different stores from provided context.
Keys for Storage to access different stores from provided context.
Keys for Storage to access different stores from provided context.
Keys for Storage to access different stores from provided context.
# Structs
AccessData interfacing database to osin storage I/O of same name.
AccessDataStore serves generic CURD for type AccessData Generated by gourd CLI tool.
AuthorizeData interfacing database to osin storage I/O of same name.
AuthorizeDataStore serves generic CURD for type AuthorizeData Generated by gourd CLI tool.
Client implements the osin Client interface.
ClientStore serves generic CURD for type Client Generated by gourd CLI tool.
Endpoints contains http handler func of different endpoints.
LoginFormContext represents the context of the login form rendering.
Manager handles oauth2 related request Also provide middleware for other http handler function to access scope related information.
Storage implements osin.Storage.
User of the API server.
UserStore serves generic CURD for type User Generated by gourd CLI tool.
# Interfaces
OAuth2User is the generic user interface for OAuth2 login check.
# Type aliases
LoginFormFunc handles GET request of the authorize endpoint and displays a login form for user to login.
Scopes represents a list of scope.
UserFunc reads the login form request and returns an OAuth2User for the reqeust.