Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auther ¶
type Auther interface {
MustAuth(next httprouter.Handle) httprouter.Handle
}
Auther is an middleware interface used to restrict web handlers that either require authentication or already have authentication and redirect to the main handler.
func NewProxyAuth ¶
func NewProxyAuth(header string, userCreator UserCreator) Auther
NewProxyAuth constructs a new proxy auther that uses a HTTP Header as the primary mechanism for authentication with the expetation that an external authentication system (like SSO or a Reverse Proxy) is already authentication
type ProxyAuth ¶
type ProxyAuth struct { Header string UserCreator UserCreator }
ProxyAuth ...
func (*ProxyAuth) MustAuth ¶
func (pa *ProxyAuth) MustAuth(next httprouter.Handle) httprouter.Handle
MustAuth returns the next handler in the chain if the configured HTTP header exists in the request (assumes trust from the proxy), storing the username in the session.
type SessionAuth ¶
type SessionAuth struct {
RedirectURL string
}
SessionAuth ...
func (*SessionAuth) MustAuth ¶
func (sa *SessionAuth) MustAuth(next httprouter.Handle) httprouter.Handle
MustAuth returns the next handler in the chain if the session has already been authenticated otherwise redirects to the login page.
type UserCreator ¶
UserCreator is called by authentication implementations like the proxy auth that have their authentication handled by another system like a parent proxy or sso and require user accounts to be created on the fly. CreateUser therefore will take a username or unique-id and create the account if it doesn't already exist.