Documentation ¶
Index ¶
- Constants
- Variables
- type Option
- type Server
- func (ws *Server) CreateUser(w http.ResponseWriter, r *http.Request)
- func (ws *Server) DeleteCredential(w http.ResponseWriter, r *http.Request)
- func (ws *Server) GetAssertion(w http.ResponseWriter, r *http.Request)
- func (ws *Server) GetCredentials(w http.ResponseWriter, r *http.Request)
- func (ws *Server) Index(w http.ResponseWriter, r *http.Request)
- func (ws *Server) Login(w http.ResponseWriter, r *http.Request)
- func (ws *Server) LoginRequired(next http.HandlerFunc) http.HandlerFunc
- func (ws *Server) MakeAssertion(w http.ResponseWriter, r *http.Request)
- func (ws *Server) MakeNewCredential(w http.ResponseWriter, r *http.Request)
- func (ws *Server) RequestNewCredential(w http.ResponseWriter, r *http.Request)
- func (ws *Server) Shutdown() error
- func (ws *Server) Start() error
- func (ws *Server) UserExists(w http.ResponseWriter, r *http.Request)
Constants ¶
const Timeout = 5 * time.Second
Timeout is the number of seconds to attempt a graceful shutdown, or for timing out read/write operations
Variables ¶
var ErrCredentialCloned = errors.New("credential appears to have been cloned")
ErrCredentialCloned occurs when an authenticator provides a sign count during assertion that is lower than the previously recorded sign count, as this would indicate that the authenticator may have been cloned.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Server)
Option is an option that sets a particular value for the server
func WithWebAuthn ¶
WithWebAuthn sets the webauthn configuration for the server
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a configurable HTTP server that implements a demo of the WebAuthn specification
func NewServer ¶
NewServer returns a new instance of a Server configured with the provided configuration
func (*Server) CreateUser ¶
func (ws *Server) CreateUser(w http.ResponseWriter, r *http.Request)
CreateUser adds a new user to the database
func (*Server) DeleteCredential ¶
func (ws *Server) DeleteCredential(w http.ResponseWriter, r *http.Request)
DeleteCredential deletes a credential from the db
func (*Server) GetAssertion ¶
func (ws *Server) GetAssertion(w http.ResponseWriter, r *http.Request)
GetAssertion - assemble the data we need to make an assertion against a given user and authenticator
func (*Server) GetCredentials ¶
func (ws *Server) GetCredentials(w http.ResponseWriter, r *http.Request)
GetCredentials gets a user's credentials from the db
func (*Server) Index ¶
func (ws *Server) Index(w http.ResponseWriter, r *http.Request)
Index renders the dashboard index page, displaying the created credential as well as any other credentials previously registered by the authenticated user.
func (*Server) Login ¶
func (ws *Server) Login(w http.ResponseWriter, r *http.Request)
Login renders the login/registration page.
func (*Server) LoginRequired ¶
func (ws *Server) LoginRequired(next http.HandlerFunc) http.HandlerFunc
LoginRequired sets a context variable with the user loaded from the user ID stored in the session cookie
func (*Server) MakeAssertion ¶
func (ws *Server) MakeAssertion(w http.ResponseWriter, r *http.Request)
MakeAssertion validates the assertion data provided by the authenticator and responds whether or not it was successful alongside the relevant credential.
func (*Server) MakeNewCredential ¶
func (ws *Server) MakeNewCredential(w http.ResponseWriter, r *http.Request)
MakeNewCredential attempts to make a new credential given an authenticator's response
func (*Server) RequestNewCredential ¶
func (ws *Server) RequestNewCredential(w http.ResponseWriter, r *http.Request)
RequestNewCredential begins a Credential Registration Request, returning a PublicKeyCredentialCreationOptions object
func (*Server) UserExists ¶
func (ws *Server) UserExists(w http.ResponseWriter, r *http.Request)
UserExists returns a boolean indicating if the user exists or not.