Documentation ¶
Index ¶
- Constants
- func NewAccessTokenFromRefreshToken(refreshToken string) (string, *errs.AppError)
- type AccessTokenClaims
- func (c AccessTokenClaims) IsRequestVerifiedWithTokenClaims(urlParams map[string]string) bool
- func (c AccessTokenClaims) IsUserRole() bool
- func (c AccessTokenClaims) IsValidAccountId(accountId string) bool
- func (c AccessTokenClaims) IsValidCustomerId(customerId string) bool
- func (c AccessTokenClaims) RefreshTokenClaims() RefreshTokenClaims
- type AuthRepository
- type AuthRepositoryDb
- type AuthToken
- type Login
- type RefreshTokenClaims
- type RolePermissions
Constants ¶
View Source
const ACCESS_TOKEN_DURATION = time.Hour
View Source
const HMAC_SAMPLE_SECRET = "hmacSampleSecret"
View Source
const REFRESH_TOKEN_DURATION = time.Hour * 24 * 30
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct { CustomerId string `json:"customer_id"` Accounts []string `json:"accounts"` Username string `json:"username"` Role string `json:"role"` jwt.StandardClaims }
func (AccessTokenClaims) IsRequestVerifiedWithTokenClaims ¶
func (c AccessTokenClaims) IsRequestVerifiedWithTokenClaims(urlParams map[string]string) bool
func (AccessTokenClaims) IsUserRole ¶
func (c AccessTokenClaims) IsUserRole() bool
func (AccessTokenClaims) IsValidAccountId ¶
func (c AccessTokenClaims) IsValidAccountId(accountId string) bool
func (AccessTokenClaims) IsValidCustomerId ¶
func (c AccessTokenClaims) IsValidCustomerId(customerId string) bool
func (AccessTokenClaims) RefreshTokenClaims ¶
func (c AccessTokenClaims) RefreshTokenClaims() RefreshTokenClaims
type AuthRepository ¶
type AuthRepositoryDb ¶
type AuthRepositoryDb struct {
// contains filtered or unexported fields
}
func NewAuthRepository ¶
func NewAuthRepository(client *sqlx.DB) AuthRepositoryDb
func (AuthRepositoryDb) FindBy ¶
func (d AuthRepositoryDb) FindBy(username, password string) (*Login, *errs.AppError)
func (AuthRepositoryDb) GenerateAndSaveRefreshTokenToStore ¶
func (d AuthRepositoryDb) GenerateAndSaveRefreshTokenToStore(authToken AuthToken) (string, *errs.AppError)
func (AuthRepositoryDb) RefreshTokenExists ¶
func (d AuthRepositoryDb) RefreshTokenExists(refreshToken string) *errs.AppError
type AuthToken ¶
type AuthToken struct {
// contains filtered or unexported fields
}
func NewAuthToken ¶
func NewAuthToken(claims AccessTokenClaims) AuthToken
type Login ¶
type Login struct { Username string `db:"username"` CustomerId sql.NullString `db:"customer_id"` Accounts sql.NullString `db:"account_numbers"` Role string `db:"role"` }
func (Login) ClaimsForAccessToken ¶
func (l Login) ClaimsForAccessToken() AccessTokenClaims
type RefreshTokenClaims ¶
type RefreshTokenClaims struct { TokenType string `json:"token_type"` CustomerId string `json:"cid"` Accounts []string `json:"accounts"` Username string `json:"un"` Role string `json:"role"` jwt.StandardClaims }
func (RefreshTokenClaims) AccessTokenClaims ¶
func (c RefreshTokenClaims) AccessTokenClaims() AccessTokenClaims
type RolePermissions ¶
type RolePermissions struct {
// contains filtered or unexported fields
}
func GetRolePermissions ¶
func GetRolePermissions() RolePermissions
func (RolePermissions) IsAuthorizedFor ¶
func (p RolePermissions) IsAuthorizedFor(role string, routeName string) bool
Click to show internal directories.
Click to hide internal directories.