Versions in this module Expand all Collapse all v1 v1.0.1 May 16, 2023 v1.0.0 May 16, 2023 Changes in this version + var DefaultGoAwayConfig = GoAwayConfig + var ErrInvalidCredentials = Response + var ResSuccessfulLogout = Response + func GenerateAccessToken(expiresAt time.Time, payload P, id, privateKey string) (string, error) + func JSONResponse(w http.ResponseWriter, code int, payload interface{}) + func Merge(a, b T) (*T, error) + func MustParseRequest(b io.ReadCloser, v interface{}) error + func NewCookie(name, value, domain, path string, expires time.Time, httpOnly, secure bool) *http.Cookie + type GoAway struct + func NewGoAway(UfC func(string, string) (U, error), UfRT func(string) (U, error), ...) (*GoAway[U, P], error) + func (g *GoAway[U, P]) Login(w http.ResponseWriter, r *http.Request) + func (g *GoAway[U, P]) Logout(w http.ResponseWriter, r *http.Request) + func (g *GoAway[U, P]) Refresh(w http.ResponseWriter, r *http.Request) + func (g *GoAway[U, P]) ValidateAccessToken(next http.Handler) http.Handler + type GoAwayClaims struct + Data P + func ValidateAccessToken(token, publicKey string) (*GoAwayClaims[P], error) + type GoAwayConfig struct + AccessTokenTTL time.Duration + ContextPayload string + CookieAccessToken string + CookieDomain string + CookieHttpOnly bool + CookiePath string + CookieRefreshToken string + CookieSecure bool + EnvAccessTokenPrivateKey string + EnvAccessTokenPublicKey string + RefreshTokenTTL time.Duration + type GoAwayFunctions struct + NewPayloadFromUser func(U) (P, error) + NewRefreshTokenFromUser func(U) (string, error) + RevokeRefreshToken func(string) error + UserFromCredentials func(string, string) (U, error) + UserFromRefreshToken func(string) (U, error) + ValidateRefreshTokenFromPayload func(string, P) error + type LoginRequest struct + Password string + Username string + type Response struct + AccessToken string + Message string + RefreshToken string + Status string + func ErrCookieIsMissing(err error) Response + func ErrFailGenerateTokenPair(err error) Response + func ErrFailRevokeRefreshToken(err error) Response + func ErrFailTokenRotation(err error) Response + func ErrInvalidAccessToken(err error) Response + func ErrInvalidRefreshToken(err error) Response + func ErrInvalidRequestBody(err error) Response + func ErrMethodNotAllowed(method string) Response