Documentation ¶
Index ¶
- Variables
- func BootstrapListeners(store Auditor, log *zap.Logger) []events.EventListener
- type ApplicationInvite
- type Auditor
- type CommonTokenDetails
- type DataStore
- func (d *DataStore) ActiveApplicationsWithUserAuthorizations(ctx context.Context, userID uuid.UUID) ([]*tables.ApplicationTable, error)
- func (d *DataStore) ActiveAuthorizationByCommonToken(ctx context.Context, tokenType string, token string) (*tables.AuthorizationTable, error)
- func (d *DataStore) ActiveAuthorizationByUserAndClientID(ctx context.Context, clientID string, userID uuid.UUID) (*tables.AuthorizationTable, error)
- func (d *DataStore) ActiveAuthorizationsByUserID(ctx context.Context, userID uuid.UUID) ([]*tables.AuthorizationTable, error)
- func (d *DataStore) AddRole(ctx context.Context, role string) (int, error)
- func (d *DataStore) AddUserToRole(ctx context.Context, id uuid.UUID, role string) error
- func (d *DataStore) ApplicationByClientID(ctx context.Context, clientID string) (*tables.ApplicationTable, error)
- func (d *DataStore) ApplicationByID(ctx context.Context, id int) (*tables.ApplicationTable, error)
- func (d *DataStore) Applications(ctx context.Context, opts ListOptions) ([]*tables.ApplicationTable, int, error)
- func (d *DataStore) Auditor() Auditor
- func (d *DataStore) AuthorizationByID(ctx context.Context, id uuid.UUID) (*tables.AuthorizationTable, error)
- func (d *DataStore) Authorizations(ctx context.Context, opts ListOptions) ([]*tables.AuthorizationTable, int, error)
- func (d *DataStore) BanUser(ctx context.Context, id uuid.UUID) error
- func (d *DataStore) Close()
- func (d *DataStore) CommonTokenDetails(ctx context.Context, tokenType string, token string) (*CommonTokenDetails, error)
- func (d *DataStore) ConfirmTokenExists(ctx context.Context, token string) (bool, error)
- func (d *DataStore) ConfirmUser(ctx context.Context, confirmToken string) (bool, uuid.UUID, error)
- func (d *DataStore) ConsumeInvite(ctx context.Context, inviteCode string) error
- func (d *DataStore) ConsumeRecoveryToken(ctx context.Context, id uuid.UUID, recoveryToken string) (bool, error)
- func (d *DataStore) CreateApplication(ctx context.Context, appType int, clientID string, clientSecret *string, ...) (int, error)
- func (d *DataStore) DeleteAllRetiredApplications(ctx context.Context) ([]string, error)
- func (d *DataStore) DeleteRole(ctx context.Context, role string) error
- func (d *DataStore) DisableMFA(ctx context.Context, id uuid.UUID) (bool, error)
- func (d *DataStore) EnableMFA(ctx context.Context, id uuid.UUID, userSecret string, userRecoveryKey string) (bool, error)
- func (d *DataStore) EnsureUsable() error
- func (d *DataStore) GrantAuthorization(ctx context.Context, applicationId int, userID uuid.UUID, ...) (uuid.UUID, error)
- func (d *DataStore) IDFromEmail(ctx context.Context, email string) (bool, uuid.UUID, error)
- func (d *DataStore) InsertCommonToken(ctx context.Context, authorizationID uuid.UUID, tokenType string, token string, ...) (int, error)
- func (d *DataStore) InsertUser(ctx context.Context, email string, passwordHash string, phone *string, ...) (uuid.UUID, error)
- func (d *DataStore) InviteCodeExists(ctx context.Context, code string) (bool, error)
- func (d *DataStore) InviteData(ctx context.Context, inviteCode string) (*UserInviteData, error)
- func (d *DataStore) InviteUser(ctx context.Context, expires time.Time, email *string, code string, ...) error
- func (d *DataStore) Invites(ctx context.Context, opts ListOptions) ([]*tables.UserInviteTable, int, error)
- func (d *DataStore) IsInviteable(ctx context.Context, email string) (bool, error)
- func (d *DataStore) IsRegistred(ctx context.Context, email string) (bool, error)
- func (d *DataStore) IsUserInRole(ctx context.Context, id uuid.UUID, role string) (bool, error)
- func (d *DataStore) LockUser(ctx context.Context, id uuid.UUID, lockTime time.Time) (bool, error)
- func (d *DataStore) ManualConfirmUser(ctx context.Context, id uuid.UUID) error
- func (d *DataStore) RedeemCommonToken(ctx context.Context, tokenType string, token string) error
- func (d *DataStore) RemoveUserFromRole(ctx context.Context, id uuid.UUID, role string) error
- func (d *DataStore) RetireApplication(ctx context.Context, id int) (int64, int64, error)
- func (d *DataStore) RevokeAuthorization(ctx context.Context, id uuid.UUID) (int64, error)
- func (d *DataStore) RevokeCommonToken(ctx context.Context, tokenType string, token string) error
- func (d *DataStore) RevokeCommonTokensForAuthorization(ctx context.Context, authorizationID uuid.UUID) (int, error)
- func (d *DataStore) Roles(ctx context.Context, opts ListOptions) ([]*tables.RoleTable, int, error)
- func (d *DataStore) SetApplicationSecret(ctx context.Context, clientID string, secret string) error
- func (d *DataStore) SetEmail(ctx context.Context, id uuid.UUID, email string) (bool, error)
- func (d *DataStore) SetFailureCount(ctx context.Context, id uuid.UUID, count int) error
- func (d *DataStore) SetInviteSent(ctx context.Context, email string, code string) error
- func (d *DataStore) SetOTPPending(ctx context.Context, id uuid.UUID, pending bool) error
- func (d *DataStore) SetPassword(ctx context.Context, id uuid.UUID, passwordHash string) (bool, error)
- func (d *DataStore) SetRecoveryToken(ctx context.Context, id uuid.UUID, recoveryToken string) (bool, error)
- func (d *DataStore) UnbanUser(ctx context.Context, id uuid.UUID) error
- func (d *DataStore) UnlockUser(ctx context.Context, id uuid.UUID) (bool, error)
- func (d *DataStore) UpdateApplicationProperties(ctx context.Context, clientID string, properties tables.MapStructure) error
- func (d *DataStore) User(ctx context.Context, userID uuid.UUID) (*tables.UserTable, error)
- func (d *DataStore) UserByEmail(ctx context.Context, email string) (*UserData, error)
- func (d *DataStore) UserByID(ctx context.Context, id uuid.UUID) (*UserData, error)
- func (d *DataStore) UserRoles(ctx context.Context, id uuid.UUID) ([]*tables.RoleTable, error)
- func (d *DataStore) Users(ctx context.Context, opts ListOptions) ([]*tables.UserTable, int, error)
- type ListOptions
- type UserAuthorization
- type UserData
- type UserInviteData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound indicates the requested entity was not found ErrNotFound = errors.New("the requested entry was not found") // ErrAlreadyExists indicates the entity already exists within the store ErrAlreadyExists = errors.New("this entity already exists") // ErrInUse signals a foreign key violation ErrInUse = errors.New("this entity is needed for another entity") )
Functions ¶
func BootstrapListeners ¶
func BootstrapListeners(store Auditor, log *zap.Logger) []events.EventListener
BootstrapListeners registers all the event listeners from this package
Types ¶
type ApplicationInvite ¶
type Auditor ¶
type Auditor interface {
// contains filtered or unexported methods
}
Auditor is a way to write audit log events into a persistent store
type CommonTokenDetails ¶
type CommonTokenDetails struct { ID int `db:"id"` AuthorizationId uuid.UUID `db:"authorization_id"` UserID uuid.UUID `db:"user_id"` TokenType string `db:"token_type"` Token string `db:"token"` Properties tables.MapStructure `db:"properties"` RedeemedAt *time.Time `db:"redeemed_at"` RevokedAt *time.Time `db:"revoked_at"` ExpiresAt time.Time `db:"expires_at"` ClientID string `db:"client_id"` IssuedAt time.Time `db:"created_at"` }
func (*CommonTokenDetails) CodeChallenge ¶
func (c *CommonTokenDetails) CodeChallenge() string
func (*CommonTokenDetails) CodeChallengeMethod ¶
func (c *CommonTokenDetails) CodeChallengeMethod() string
type DataStore ¶
type DataStore struct {
// contains filtered or unexported fields
}
func NewMysqlStore ¶
func NewPostgrestore ¶
func NewSqliteStore ¶
func (*DataStore) ActiveApplicationsWithUserAuthorizations ¶
func (*DataStore) ActiveAuthorizationByCommonToken ¶
func (*DataStore) ActiveAuthorizationByUserAndClientID ¶
func (*DataStore) ActiveAuthorizationsByUserID ¶
func (*DataStore) AddUserToRole ¶
func (*DataStore) ApplicationByClientID ¶
func (*DataStore) ApplicationByID ¶
func (*DataStore) Applications ¶
func (d *DataStore) Applications( ctx context.Context, opts ListOptions, ) ([]*tables.ApplicationTable, int, error)
func (*DataStore) AuthorizationByID ¶
func (*DataStore) Authorizations ¶
func (d *DataStore) Authorizations( ctx context.Context, opts ListOptions, ) ([]*tables.AuthorizationTable, int, error)
func (*DataStore) CommonTokenDetails ¶
func (*DataStore) ConfirmTokenExists ¶
func (*DataStore) ConfirmUser ¶
func (*DataStore) ConsumeInvite ¶
func (*DataStore) ConsumeRecoveryToken ¶
func (*DataStore) CreateApplication ¶
func (*DataStore) DeleteAllRetiredApplications ¶
func (*DataStore) DeleteRole ¶
func (*DataStore) DisableMFA ¶
func (*DataStore) EnsureUsable ¶
func (*DataStore) GrantAuthorization ¶
func (*DataStore) IDFromEmail ¶
func (*DataStore) InsertCommonToken ¶
func (*DataStore) InsertUser ¶
func (*DataStore) InviteCodeExists ¶
func (*DataStore) InviteData ¶
func (*DataStore) InviteUser ¶
func (*DataStore) Invites ¶
func (d *DataStore) Invites( ctx context.Context, opts ListOptions, ) ([]*tables.UserInviteTable, int, error)
func (*DataStore) IsInviteable ¶
func (*DataStore) IsRegistred ¶
func (*DataStore) IsUserInRole ¶
func (*DataStore) ManualConfirmUser ¶
func (*DataStore) RedeemCommonToken ¶
func (*DataStore) RemoveUserFromRole ¶
func (*DataStore) RetireApplication ¶
func (*DataStore) RevokeAuthorization ¶
func (*DataStore) RevokeCommonToken ¶
func (*DataStore) RevokeCommonTokensForAuthorization ¶
func (*DataStore) SetApplicationSecret ¶
func (*DataStore) SetFailureCount ¶
func (*DataStore) SetInviteSent ¶
func (*DataStore) SetOTPPending ¶
func (*DataStore) SetPassword ¶
func (*DataStore) SetRecoveryToken ¶
func (*DataStore) UnlockUser ¶
func (*DataStore) UpdateApplicationProperties ¶
func (*DataStore) UserByEmail ¶
type UserAuthorization ¶
type UserData ¶
type UserData struct { ID uuid.UUID Email string EmailConfirmed *time.Time Phone *string PhoneConfirmed *time.Time TwoFactor bool TwoFactorSecret string OtpPending bool BannedOn *time.Time LockoutTill *time.Time PasswordHash []byte CurrentFailureCount int LastSignIn *time.Time Roles []string Authorizations []*UserAuthorization }
type UserInviteData ¶
type UserInviteData struct { Roles []string Expires time.Time PreApplicationAuthorization []ApplicationInvite }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.