Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrForbidden = errors.New("forbidden") )
View Source
var KnownCredentialsRolesWithImportance = map[CredentialsRole]CredentialRoleImportance{ CredentialsRoleUser: CredentialRoleImportanceUser, CredentialsRoleAdmin: CredentialRoleImportanceAdmin, CredentialsRoleSuperAdmin: CredentialRoleImportanceSuperAdmin, }
Functions ¶
This section is empty.
Types ¶
type AccessTokenClaims ¶
type AccessTokenClaims struct {
// ID of the user that created the session. Can be empty for anonymous sessions.
UserID *uuid.UUID `json:"userID,omitempty"`
// Roles is a list of Role attributed to the session.
Roles []Role `json:"roles"`
// The ID of the refresh token that created the session. If the session was created using direct login, this
// field is empty.
RefreshTokenID *string `json:"refreshTokenID,omitempty"`
}
AccessTokenClaims is authenticated (signed) information about a session. This data is embed in the access tokens.
type CredentialRoleImportance ¶
type CredentialRoleImportance int
const ( CredentialRoleImportanceUnknown CredentialRoleImportance = 0 CredentialRoleImportanceUser CredentialRoleImportance = 1 CredentialRoleImportanceAdmin CredentialRoleImportance = 2 CredentialRoleImportanceSuperAdmin CredentialRoleImportance = 3 )
func (CredentialRoleImportance) Int ¶ added in v1.0.0
func (importance CredentialRoleImportance) Int() int
type CredentialsRole ¶
type CredentialsRole string
const ( CredentialsRoleUser CredentialsRole = "user" CredentialsRoleAdmin CredentialsRole = "admin" CredentialsRoleSuperAdmin CredentialsRole = "super_admin" )
func (CredentialsRole) String ¶ added in v1.0.0
func (role CredentialsRole) String() string
type CredentialsRoles ¶ added in v1.0.0
type CredentialsRoles []CredentialsRole
func (CredentialsRoles) Strings ¶ added in v1.0.0
func (roles CredentialsRoles) Strings() []string
type MailTemplates ¶ added in v1.0.0
type Permission ¶
type Permission string
Permission is a special attribute that grants a session access to an authenticated resource. Each service may define its own set of authorizations.
type RefreshTokenClaims ¶
type RefreshTokenClaimsInput ¶ added in v0.6.0
type Role ¶
type Role string
Role is a special attributes that is assigned to a session. It grants said session a given set of Permission.
const ( // RoleAnon represents an anonymous user. RoleAnon Role = "auth:anon" // RoleUser represents a regular user. RoleUser Role = "auth:user" // RoleAdmin represents an administrator. RoleAdmin Role = "auth:admin" // RoleSuperAdmin represents a super administrator. RoleSuperAdmin Role = "auth:super_admin" )
type SMTPURLsConfig ¶ added in v1.0.0
type ShortCode ¶
type ShortCode struct {
ID uuid.UUID
// Information about the resource the short code grants access to.
Usage ShortCodeUsage
// The target that is allowed to access the resource. Only this target can retrieve the short code.
Target string
// Data used for the targeted resource. It can contain any information required to perform a specific action.
Data []byte
// Time at which the short code was created.
CreatedAt time.Time
// Expiration of the short code. Each short code is REQUIRED to expire past a certain time. Once the expiration date
// is reached, the short code can no longer be used or retrieved.
ExpiresAt time.Time
// PlainCode is the clear password sent to the target via a secure channel.
PlainCode string
}
ShortCode is a temporary password used to grant a user one-time access to a specific resource. Once a resource is accessed using a short code, the short code is expired.
type ShortCodeUsage ¶
type ShortCodeUsage string
ShortCodeUsage gives information about the intended usage of a short code.
const ( ShortCodeUsageValidateMail ShortCodeUsage = "validateMail" ShortCodeUsageResetPassword ShortCodeUsage = "resetPassword" ShortCodeUsageRequestRegister ShortCodeUsage = "requestRegister" )
func (ShortCodeUsage) String ¶ added in v1.0.0
func (usage ShortCodeUsage) String() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.