Documentation
¶
Index ¶
- Variables
- type Dialect
- type Handlers
- func (h *Handlers) AddBegin(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) AddFinish(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) Delete(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) LoginBegin(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) LoginFinish(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) SessionRevoke(w http.ResponseWriter, r *http.Request)
- type Info
- type LoginUser
- type Service
- func (s *Service) BeginLogin(r *http.Request) (*protocol.CredentialAssertion, string, error)
- func (s *Service) BeginRegistration(r *http.Request, userID int64, email string) (*protocol.CredentialCreation, error)
- func (s *Service) Delete(userID, id int64) error
- func (s *Service) FinishLogin(r *http.Request, token string) (int64, error)
- func (s *Service) FinishRegistration(r *http.Request, userID int64, email, name string) error
- func (s *Service) List(userID int64) ([]Info, error)
- func (s *Service) ListSessions(userID int64, currentRefresh string) ([]SessionInfo, error)
- func (s *Service) RevokeSession(userID, id int64) error
- func (s *Service) TagSession(refreshToken, location, userAgent string)
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SQLite = Dialect{Now: "CURRENT_TIMESTAMP", RowID: "id", StartedAlt: "created_at", TimeArgs: true} SQLiteRowID = Dialect{Now: "CURRENT_TIMESTAMP", RowID: "rowid", StartedAlt: "expires_at", TimeArgs: true, TagStartedAt: true} MySQL = Dialect{Now: "NOW()", RowID: "id", StartedAlt: "created_at", TagStartedAt: true} )
View Source
var ErrRejected = errors.New("passkey not recognised")
Functions ¶
This section is empty.
Types ¶
type Handlers ¶
type Handlers struct {
Svc *Service
Tag string
SettingsURL string
ClientIP func(r *http.Request) string
LoadUser func(id int64) (LoginUser, error)
Start2FA func(w http.ResponseWriter, r *http.Request, u LoginUser) (string, error)
IssueSession func(w http.ResponseWriter, r *http.Request, u LoginUser) (dest string, code string, err error)
CurrentUser func(r *http.Request) (id int64, email string, ok bool)
Record func(r *http.Request, userID int64, action, detail string)
Flash func(w http.ResponseWriter, r *http.Request, kind, key string)
}
func (*Handlers) LoginBegin ¶
func (h *Handlers) LoginBegin(w http.ResponseWriter, r *http.Request)
func (*Handlers) LoginFinish ¶
func (h *Handlers) LoginFinish(w http.ResponseWriter, r *http.Request)
func (*Handlers) SessionRevoke ¶
func (h *Handlers) SessionRevoke(w http.ResponseWriter, r *http.Request)
type Service ¶
type Service struct {
DB func() *sql.DB
DisplayName string
Dialect Dialect
Revoke func(ctx context.Context, userID int64, sid string) error
}
func (*Service) BeginLogin ¶
func (*Service) BeginRegistration ¶
func (*Service) FinishLogin ¶
func (*Service) FinishRegistration ¶
func (*Service) ListSessions ¶
func (s *Service) ListSessions(userID int64, currentRefresh string) ([]SessionInfo, error)
func (*Service) RevokeSession ¶
func (*Service) TagSession ¶
Click to show internal directories.
Click to hide internal directories.