Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrWrongCredentials is returned when credentials do not match. ErrWrongCredentials = errors.New("wrong username or password") // ErrInvalidToken is returned when a refresh token is invalid. ErrInvalidToken = errors.New("invalid token") // ErrNotFound is returned whenever an item does not exist in the database. ErrNotFound = errors.New("item not found") )
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface { Login(username, password string) (*Grant, error) Refresh(refreshToken string) (*Grant, error) }
AuthService specifies the operations needed for authentication.
func NewAuthService ¶
func NewAuthService( userStore UserStore, shimmieDB shimmie.Store, wl Whitelist, accTokDur time.Duration, refTokDur time.Duration, issuer string, secret string, ) AuthService
NewAuthService should be used for creating a new AuthService by providing a shimmie Store and a secret.
type Grant ¶
Grant is the result of successful authentication and contains access and refresh tokens.
type Whitelist ¶
type Whitelist interface { GetToken(tokenID string) (*jwt.Token, error) PutToken(tokenID string, t *jwt.Token) error }
Whitelist describes the operations needed to keep refresh tokens in a "whitelist" session storage. If a refresh token exists in the storage and assuming it is not expired then it is considered valid.
Click to show internal directories.
Click to hide internal directories.