Documentation
¶
Overview ¶
Package authhttp adapts authentication HTTP requests to the auth usecase.
Index ¶
- Constants
- func CSRFMiddlewareConfig(exemptions []middlewares.RouteExemption, secure bool) middleware.CSRFConfig
- func ClearCSRFCookie(c *echo.Context, secure bool)
- func ClearLoginSessionCookie(c *echo.Context, secure bool)
- func NewCSRFToken() (string, error)
- func Register(group *echo.Group, handler *Handler)
- func SetCSRFCookie(c *echo.Context, token string, expiresAt time.Time, secure bool)
- func SetLoginSessionCookie(c *echo.Context, token string, expiresAt time.Time, secure bool)
- type Handler
- func (h *Handler) ChangePassword(c *echo.Context) error
- func (h *Handler) Login(c *echo.Context) error
- func (h *Handler) Logout(c *echo.Context) error
- func (h *Handler) LogoutOthers(c *echo.Context) error
- func (h *Handler) Me(c *echo.Context) error
- func (h *Handler) SwitchRole(c *echo.Context) error
- func (h *Handler) UpdateProfile(c *echo.Context) error
Constants ¶
const ( // LoginSessionCookieName is the HttpOnly browser credential for login // sessions. The composition root injects this name into the login-session // middleware so read and write sides share one declaration. LoginSessionCookieName = "login_session" // CSRFCookieName is the browser-readable double-submit CSRF cookie. CSRFCookieName = "csrf_token" )
Variables ¶
This section is empty.
Functions ¶
func CSRFMiddlewareConfig ¶
func CSRFMiddlewareConfig(exemptions []middlewares.RouteExemption, secure bool) middleware.CSRFConfig
CSRFMiddlewareConfig returns the Echo CSRF middleware configuration used for browser login-session requests. It shares the login-session exemptions because a route without a login session has no CSRF obligation.
func ClearCSRFCookie ¶
ClearCSRFCookie removes the browser-readable CSRF token.
func ClearLoginSessionCookie ¶
ClearLoginSessionCookie removes the browser session credential.
func NewCSRFToken ¶
NewCSRFToken creates a browser-readable CSRF token for login responses.
func SetCSRFCookie ¶
SetCSRFCookie stores the browser-readable CSRF token used by Echo's CSRF middleware.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler adapts auth HTTP requests to the auth usecase.
func (*Handler) ChangePassword ¶
ChangePassword updates the current administrator password and revokes other login sessions for the same administrator.
func (*Handler) LogoutOthers ¶
LogoutOthers revokes the current administrator's other login sessions.
func (*Handler) SwitchRole ¶
SwitchRole changes the active role for the current administrator.