Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHandler ¶
BuildHandler builds a handlerutils.Handler and passes in the *Claims if set, returns http.StatusUnauthorized if not.
Types ¶
type Auth ¶
type Auth struct {
Providers []Provider
}
Auth contains the signing key for generation signed tokens
func (*Auth) Middleware ¶
Middleware ensures that a request is authentic before passing the request on to the next middleware in the stack. It will inject a Claim struct into the request context on successful authentication This Claim can be retrieved in downsteam handlers via UserFromContext.
type CreateUser ¶
CreateUser is the struct containing all parameters necessary to create a user
type Provider ¶
The Provider interface describes and authentication provider, it contains two methods: - Valid which checks whether the given request is attempting to authenticate with a given provider - Authenticate which attempts to authenticate the request
type SQLUserStore ¶
type SQLUserStore struct {
// contains filtered or unexported fields
}
SQLUserStore is an SQL implementation of UserStore
func NewSQLUserStore ¶
func NewSQLUserStore(db *hnysqlx.DB) *SQLUserStore
NewSQLUserStore configures a new SQLUserStore
func TestSQLUserStore ¶
TestSQLUserStore builds a new test sql user store
func (*SQLUserStore) Create ¶
func (s *SQLUserStore) Create(cu *CreateUser) (*User, error)
Create persists a new user to the store
func (*SQLUserStore) Get ¶
func (s *SQLUserStore) Get(id string) (*User, error)
Get fetches a user from the store based on their ID
func (*SQLUserStore) GetByGithubID ¶
func (s *SQLUserStore) GetByGithubID(id string) (*User, error)
GetByGithubID fetches a user from the store based on their GithubID