Documentation ¶
Overview ¶
package login contains an optional "login" (authentication) server that can be used. It offers a simple (in the future customizable) login form that sends username / password via POST formdata to a /login endpoint. The authentication server then issues a cookie-based session.
This package can be used to turn oauth2go in a more-or-less complete authentication service. If this package is not used, an external authentication page that establishes a web-session with the user is needed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler() *handler
func WithBaseURL ¶ added in v0.5.10
func WithBaseURL(url string) handlerOption
func WithLoginPage ¶
func WithLoginPage(opts ...handlerOption) oauth2.AuthorizationServerOption
func WithPassswordHasher ¶ added in v0.3.0
func WithPassswordHasher(pwh PasswordHasher) handlerOption
Types ¶
type PasswordHasher ¶ added in v0.3.0
type PasswordHasher interface { // CompareHashAndPassword compares a hash and a password. If successful, no error is returned. CompareHashAndPassword(hash []byte, password []byte) (err error) // GenerateFromPassword generates a hash out of a password. opts can be used to supply // implementation specific parameters. GenerateFromPassword(password []byte, opts ...interface{}) (hash []byte, err error) }
PasswordHasher is an interface that can be used to support different password hashing algorithms in our login server. Basically, two functions need to be implemented, one for creating a hash out of a password and one for comparing a hash with a password.