auth

package
v0.0.0-...-2c276d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

SPDX-License-Identifier: Apache-2.0 Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>

Index

Constants

View Source
const HeaderNameWAN = "webauthn"
View Source
const SessionNameWANAuth = "wan-auth"
View Source
const SessionNameWANRegister = "wan-register"

Variables

This section is empty.

Functions

func Cleanup

func Cleanup() error

func Enforce2FA

func Enforce2FA(handler httprouter.Handle) httprouter.Handle

func LoginHandler

func LoginHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func NewToken

func NewToken() string

func RegisterSecondFactor

func RegisterSecondFactor() httprouter.Handle

func RequireAdmin

func RequireAdmin(handler httprouter.Handle) httprouter.Handle

func RequireAdminOrRedirect

func RequireAdminOrRedirect(handler httprouter.Handle, target string) httprouter.Handle

func RequireAuth

func RequireAuth(handler httprouter.Handle) httprouter.Handle

func RequireAuthOrRedirect

func RequireAuthOrRedirect(handler httprouter.Handle, target string) httprouter.Handle

func Route

func Route(wan *webauthn.WebAuthn, db db.Session, router http.Handler) http.Handler

Types

type Session

type Session struct {
	Token   string    `db:"token"`
	UserID  int       `db:"user"`
	Expires time.Time `db:"expires"`
}

func NewSession

func NewSession(user *user.User, table db.Collection) (*Session, error)

func (*Session) Store

func (s *Session) Store(sess db.Session) db.Store

type SessionUser

type SessionUser struct {
	Token     string    `db:"token"`
	UserID    int       `db:"user"`
	Expires   time.Time `db:"expires"`
	user.User `db:",inline"`
}

func (*SessionUser) Expired

func (s *SessionUser) Expired() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL