Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationManager ¶
type AuthenticationManager struct {
AuthMethods []AuthenticationMethod
}
AuthenticationManager A simple type for managing abstract authentication methods
func (*AuthenticationManager) MatchToken ¶
func (am *AuthenticationManager) MatchToken(prefix string) *AuthenticationMethod
MatchToken matches a provided string with the token format of an AuthenticationMethod
func (*AuthenticationManager) RegisterAuthenticationMethod ¶
func (am *AuthenticationManager) RegisterAuthenticationMethod(method AuthenticationMethod)
RegisterAuthenticationMethod Registers an authentication method with the manager
func (*AuthenticationManager) RegisterHandlers ¶
func (am *AuthenticationManager) RegisterHandlers(e *gin.Engine)
RegisterHandlers Registers the http handlers for each of the authentication methods with a gin Engine
type AuthenticationMethod ¶
type AuthenticationMethod interface { // Register any handlers required for handling the user's authentication. Note: for externally-authenticated // methods, this may not be required RegisterHandlers(*gin.Engine) // Takes an authorization token and extracts the user's identity from it (a simple string user id for now) ExtractIdentity(string) (string, error) // The prefix used to the actual token in the authorization header AuthHeaderPrefix() string // Injects a "login" prompt / button into the "login methods" popup GetLoginButton() template.HTML // Injects into the "head" of the HTML any scripts or meta info GetLoginHeader() template.HTML }
AuthenticationMethod An interface for authentication methods to plug into the router and the web page
func NewNoAuth ¶
func NewNoAuth() AuthenticationMethod
NewNoAuth Creates a new instance of the no-pw-required authentication method for testing / development
Click to show internal directories.
Click to hide internal directories.