Documentation ¶
Index ¶
- Variables
- func FetchAuth(ctx context.Context, authD *TokenMetaDetails) (int64, error)
- func TokenValid(r *http.Request, name string, secret string) error
- func VerifyToken(r *http.Request, name string, secret string) (*jwt.Token, error)
- type AuthService
- type CookieAccess
- type TokenDetails
- type TokenMetaDetails
Constants ¶
This section is empty.
Variables ¶
View Source
var AccessUuidKey = contextKey(contextKey{key: "access-uuid"})
View Source
var ErrExpiredToken = errors.New("token expired")
View Source
var ErrIncompatibleVersion = errors.New("incompatible version of argon2")
View Source
var ErrInvalidHash = errors.New("the encoded hash is not in the correct format")
View Source
var RefreshUserIDKey = contextKey(contextKey{"refresh-user-id"})
View Source
var RefreshUuidKey = contextKey(contextKey{"refresh-uuid"})
View Source
var UserIDKey = contextKey(contextKey{key: "user-id"})
Functions ¶
Types ¶
type AuthService ¶
type AuthService interface { GetUserID(context.Context) (int64, error) AuthMiddleware(http.Handler) http.Handler GetPasswordHash(string) ([]byte, error) VerifyPasswordHash(string, []byte) (bool, error) Login(context.Context, int64, string) error Logout(context.Context) error Refresh(context.Context, string) (int64, error) }
func NewAuth ¶
func NewAuth(aSecret string, rSecret string) AuthService
type CookieAccess ¶
type CookieAccess struct {
Writer http.ResponseWriter
}
func (*CookieAccess) RemoveToken ¶
func (access *CookieAccess) RemoveToken(name string)
type TokenDetails ¶
type TokenMetaDetails ¶
func ExtractTokenMetadata ¶
Click to show internal directories.
Click to hide internal directories.