Documentation
¶
Overview ¶
Package nethttp adapts goauth to standard-library JSON HTTP handlers.
Index ¶
- func AuthContext(ctx context.Context) (goauth.AuthContext, bool)
- func WriteError(w http.ResponseWriter, err error)
- type Adapter
- func (a *Adapter) ChangePassword(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) ConfirmEmailChange(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) Login(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) Logout(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) LogoutAll(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) Refresh(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) Register(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) RequestEmailChange(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) RequireRealm(realm goauth.Realm, options RealmMiddlewareOptions) func(http.Handler) http.Handler
- func (a *Adapter) ResetPassword(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) SendEmailChallenge(w http.ResponseWriter, r *http.Request)
- func (a *Adapter) VerifyEmailChallenge(w http.ResponseWriter, r *http.Request)
- type ErrorBody
- type ErrorResponse
- type PasswordEmailChangeRuntime
- type RealmMiddlewareOptions
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthContext ¶
func AuthContext(ctx context.Context) (goauth.AuthContext, bool)
func WriteError ¶
func WriteError(w http.ResponseWriter, err error)
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func (*Adapter) ChangePassword ¶
func (a *Adapter) ChangePassword(w http.ResponseWriter, r *http.Request)
func (*Adapter) ConfirmEmailChange ¶
func (a *Adapter) ConfirmEmailChange(w http.ResponseWriter, r *http.Request)
func (*Adapter) RequestEmailChange ¶
func (a *Adapter) RequestEmailChange(w http.ResponseWriter, r *http.Request)
func (*Adapter) RequestPasswordReset ¶
func (a *Adapter) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
func (*Adapter) RequireRealm ¶
func (*Adapter) ResetPassword ¶
func (a *Adapter) ResetPassword(w http.ResponseWriter, r *http.Request)
func (*Adapter) SendEmailChallenge ¶
func (a *Adapter) SendEmailChallenge(w http.ResponseWriter, r *http.Request)
func (*Adapter) VerifyEmailChallenge ¶
func (a *Adapter) VerifyEmailChallenge(w http.ResponseWriter, r *http.Request)
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorBody `json:"error"`
}
type PasswordEmailChangeRuntime ¶
type PasswordEmailChangeRuntime interface {
RequestEmailChangeWithPassword(ctx context.Context, request goauth.PasswordEmailChangeRequest) error
}
PasswordEmailChangeRuntime is an optional capability required only by the email-change handler. Older Runtime implementations remain source compatible, but this handler fails closed instead of calling the trusted subject-only API.
type RealmMiddlewareOptions ¶
type RealmMiddlewareOptions struct {
// OfflineJWT skips revocation checks; use only where up to five minutes of
// stale authorization is explicitly acceptable.
OfflineJWT bool
AllowConfirmation bool
}
RealmMiddlewareOptions controls session verification. The zero value checks persisted session and subject state on every request.
type Runtime ¶
type Runtime interface {
Logout(ctx context.Context, subjectID goauth.SubjectID, sessionID string) error
LogoutAll(ctx context.Context, subjectID goauth.SubjectID) (int64, error)
ChangePassword(ctx context.Context, request goauth.ChangePasswordRequest) (goauth.Account, error)
RequestEmailChange(ctx context.Context, subjectID goauth.SubjectID, email string) error
ConfirmEmailChange(ctx context.Context, subjectID goauth.SubjectID, code string) (goauth.Account, error)
Register(ctx context.Context, request goauth.RegisterRequest) (goauth.RegisterResult, error)
Login(ctx context.Context, request goauth.LoginRequest) (goauth.LoginResult, error)
Refresh(ctx context.Context, refreshToken string) (goauth.TokenPair, error)
AuthenticateSession(ctx context.Context, accessToken string) (goauth.AuthContext, error)
VerifyJWT(ctx context.Context, accessToken string) (goauth.AuthContext, error)
RequestPasswordReset(ctx context.Context, email string) error
ResetPassword(ctx context.Context, token, newPassword string) error
SendEmailChallenge(ctx context.Context, subjectID goauth.SubjectID, purpose goauth.EmailChallengePurpose) error
VerifyEmailChallenge(
ctx context.Context,
subjectID goauth.SubjectID,
purpose goauth.EmailChallengePurpose,
code string,
) (goauth.Account, error)
}
Click to show internal directories.
Click to hide internal directories.