Documentation ¶
Index ¶
- Variables
- func GetDB(name string) *bolt.DB
- func GetRandomName(n int) []byte
- func Login(requestUser *backends.User, ab backends.Authentication, secret []byte, exp int) (int, []byte)
- func Logout(req *http.Request, ab backends.Authentication, secret []byte, exp int) error
- func RefreshToken(requestUser *backends.User, ab backends.Authentication, secret []byte, exp int) []byte
- type AuthMiddleware
- type Client
- type JWTAuthenticationBackend
- func (backend *JWTAuthenticationBackend) Authenticate(user *backends.User) bool
- func (backend *JWTAuthenticationBackend) GenerateToken(userUUID, username string) (string, error)
- func (backend *JWTAuthenticationBackend) IsInBlacklist(token string) bool
- func (backend *JWTAuthenticationBackend) Logout(tokenString string, token *jwt.Token) error
- type Token
- type TokenAuthentication
Constants ¶
This section is empty.
Variables ¶
View Source
var TestDB *bolt.DB
TestDB - holds connection to database during tests
Functions ¶
func GetRandomName ¶
GetRandomName - provides random name for buckets. Each test case gets it's own bucket
func RefreshToken ¶
Types ¶
type AuthMiddleware ¶
type AuthMiddleware struct { AB backends.Authentication SecretKey []byte JWTExpirationDelta int Enabled bool }
func GetNewAuthenticationMiddleware ¶
func GetNewAuthenticationMiddleware(authBackend backends.Authentication, secretKey []byte, exp int, enabled bool) *AuthMiddleware
func (*AuthMiddleware) RequireTokenAuthentication ¶
func (a *AuthMiddleware) RequireTokenAuthentication(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)
type JWTAuthenticationBackend ¶
type JWTAuthenticationBackend struct { SecretKey []byte JWTExpirationDelta int AuthBackend backends.Authentication }
func InitJWTAuthenticationBackend ¶
func InitJWTAuthenticationBackend(ab backends.Authentication, secret []byte, exp int) *JWTAuthenticationBackend
func (*JWTAuthenticationBackend) Authenticate ¶
func (backend *JWTAuthenticationBackend) Authenticate(user *backends.User) bool
func (*JWTAuthenticationBackend) GenerateToken ¶
func (backend *JWTAuthenticationBackend) GenerateToken(userUUID, username string) (string, error)
func (*JWTAuthenticationBackend) IsInBlacklist ¶
func (backend *JWTAuthenticationBackend) IsInBlacklist(token string) bool
type TokenAuthentication ¶
type TokenAuthentication struct {
Token string `json:"token" form:"token"`
}
Click to show internal directories.
Click to hide internal directories.