Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator securely authenticates an user's identity.
func NewAuthenticator ¶
func NewAuthenticator( tokenizer crypto.Tokenizer, timer timer.Timer, tokenValidDuration time.Duration, ) Authenticator
NewAuthenticator initializes authenticator with custom token valid duration
func NewAuthenticatorFake ¶
func NewAuthenticatorFake(current time.Time, validPeriod time.Duration) Authenticator
NewAuthenticatorFake creates fake authenticator for easy testing.
func (Authenticator) GenerateToken ¶
func (a Authenticator) GenerateToken(user entity.User) (string, error)
GenerateToken encodes part of user data into authentication token
func (Authenticator) GetUser ¶
func (a Authenticator) GetUser(token string) (entity.User, error)
GetUser decodes authentication token to user data
func (Authenticator) IsSignedIn ¶
func (a Authenticator) IsSignedIn(token string) bool
IsSignedIn checks whether user successfully signed in
type Credential ¶
type Credential struct {
APIKey *string
}
Credential encodes the identity of API consumer.
type Payload ¶
type Payload struct {
// contains filtered or unexported fields
}
Payload represents the metadata encoded in the authentication token.
func (Payload) TokenPayload ¶
func (p Payload) TokenPayload() crypto.TokenPayload
TokenPayload retrieves key-value pairs representation of the payload.
type ThirdPartyApp ¶
type ThirdPartyApp struct {
// contains filtered or unexported fields
}
ThirdPartyApp authenticates the identity of a third party application.
func NewThirdPartyApp ¶
func NewThirdPartyApp( authorizer authorizer.Authorizer, tokenizer crypto.Tokenizer, keyGen keygen.KeyGenerator, timer timer.Timer, apiKeyRepo repository.APIKey, appRepo repository.App, ) ThirdPartyApp
NewThirdPartyApp creates ThirdPartyApp authenticator.
func (ThirdPartyApp) GenerateAPIKey ¶
GenerateAPIKey generates a new API key for the given app.
func (ThirdPartyApp) GetApp ¶
func (t ThirdPartyApp) GetApp(cred Credential) (entity.App, error)
GetApp retrieves app information based on the credential provided.