Documentation ¶
Index ¶
- Constants
- func AdminOnlyMiddleware(h SessionHandler) echo.MiddlewareFunc
- func AuthIsValid(c echo.Context) bool
- func CreateHeaderAuthMiddleware() echo.MiddlewareFunc
- func EnforceAuthMiddleware(args EnforceAuthArgs) echo.MiddlewareFunc
- func EnforceMFAMiddleware(s SessionHandler) echo.MiddlewareFunc
- func InitWebAuthn(baseURL url.URL)
- func IsWebAuthnAvailable() bool
- func MFAWebAuthnBeginLogin(c echo.Context, sessHandler SessionHandler) (marshalledJSONResponse []byte, userPresentableErr error, internalErr error)
- func MFAWebAuthnBeginRegister(c echo.Context, sessHandler SessionHandler) (marshalledJSONResponse []byte, userPresentableErr error, internalErr error)
- func MFAWebAuthnFinishLogin(c echo.Context, sessHandler SessionHandler) (userPresentableErr error, internalErr error)
- func MFAWebAuthnFinishRegister(c echo.Context, sessHandler SessionHandler) (userPresentableErr error, internalErr error)
- func RoleRestrictedMiddleware(allowedRoles []string, disallowedRoles []string) echo.MiddlewareFunc
- func UserFromReq(c echo.Context) *db.User
- type EnforceAuthArgs
- type InMemorySessionHandler
- func (s *InMemorySessionHandler) CreateMiddleware() echo.MiddlewareFunc
- func (s *InMemorySessionHandler) Destroy(c echo.Context) error
- func (s *InMemorySessionHandler) LogoutAllSessionsForUser(userId string) error
- func (s *InMemorySessionHandler) Refresh(c echo.Context) error
- func (s *InMemorySessionHandler) Rotate(c echo.Context) error
- func (s *InMemorySessionHandler) Start(c echo.Context, sess SessionData) error
- func (s *InMemorySessionHandler) UpdateSessionData(c echo.Context, updateFunc func(*SessionData) error) error
- type SessionData
- type SessionHandler
Constants ¶
View Source
const (
MFATypeWebAuthn = "MFATypeWebAuthn"
)
Variables ¶
This section is empty.
Functions ¶
func AdminOnlyMiddleware ¶
func AdminOnlyMiddleware(h SessionHandler) echo.MiddlewareFunc
func AuthIsValid ¶
func AuthIsValid(c echo.Context) bool
func CreateHeaderAuthMiddleware ¶
func CreateHeaderAuthMiddleware() echo.MiddlewareFunc
func EnforceAuthMiddleware ¶
func EnforceAuthMiddleware(args EnforceAuthArgs) echo.MiddlewareFunc
func EnforceMFAMiddleware ¶
func EnforceMFAMiddleware(s SessionHandler) echo.MiddlewareFunc
func InitWebAuthn ¶
func IsWebAuthnAvailable ¶
func IsWebAuthnAvailable() bool
func MFAWebAuthnBeginLogin ¶
func MFAWebAuthnBeginLogin(c echo.Context, sessHandler SessionHandler) (marshalledJSONResponse []byte, userPresentableErr error, internalErr error)
func MFAWebAuthnBeginRegister ¶
func MFAWebAuthnBeginRegister(c echo.Context, sessHandler SessionHandler) (marshalledJSONResponse []byte, userPresentableErr error, internalErr error)
func MFAWebAuthnFinishLogin ¶
func MFAWebAuthnFinishLogin(c echo.Context, sessHandler SessionHandler) (userPresentableErr error, internalErr error)
func MFAWebAuthnFinishRegister ¶
func MFAWebAuthnFinishRegister(c echo.Context, sessHandler SessionHandler) (userPresentableErr error, internalErr error)
func UserFromReq ¶
Types ¶
type EnforceAuthArgs ¶
type EnforceAuthArgs struct {
BypassPaths []string
}
type InMemorySessionHandler ¶
type InMemorySessionHandler struct { CookieName string SessionTimeout time.Duration SessionMaxLifetime time.Duration // contains filtered or unexported fields }
func (*InMemorySessionHandler) CreateMiddleware ¶
func (s *InMemorySessionHandler) CreateMiddleware() echo.MiddlewareFunc
func (*InMemorySessionHandler) Destroy ¶
func (s *InMemorySessionHandler) Destroy(c echo.Context) error
func (*InMemorySessionHandler) LogoutAllSessionsForUser ¶
func (s *InMemorySessionHandler) LogoutAllSessionsForUser(userId string) error
func (*InMemorySessionHandler) Refresh ¶
func (s *InMemorySessionHandler) Refresh(c echo.Context) error
func (*InMemorySessionHandler) Rotate ¶
func (s *InMemorySessionHandler) Rotate(c echo.Context) error
func (*InMemorySessionHandler) Start ¶
func (s *InMemorySessionHandler) Start(c echo.Context, sess SessionData) error
func (*InMemorySessionHandler) UpdateSessionData ¶
func (s *InMemorySessionHandler) UpdateSessionData(c echo.Context, updateFunc func(*SessionData) error) error
type SessionData ¶
type SessionData struct { UserID string HasCompletedMFA bool WebAuthnSession *webauthn.SessionData PendingWebAuthnUser *webauthnUser }
func SessionDataFromReq ¶
func SessionDataFromReq(c echo.Context) *SessionData
func UserAndSessFromReq ¶
func UserAndSessFromReq(c echo.Context) (*db.User, *SessionData)
type SessionHandler ¶
type SessionHandler interface { CreateMiddleware() echo.MiddlewareFunc Start(echo.Context, SessionData) error Destroy(echo.Context) error Refresh(echo.Context) error Rotate(echo.Context) error // Rotate session cookie, to mitigate session fixation UpdateSessionData(c echo.Context, updateFunc func(*SessionData) error) error LogoutAllSessionsForUser(id string) error }
Click to show internal directories.
Click to hide internal directories.