Documentation
¶
Index ¶
- func MapToInfo(p *Info) types.PrincipalInfo
- type Info
- type InfoView
- type PrincipalOrmStore
- func (s *PrincipalOrmStore) CountServiceAccounts(ctx context.Context, parentType enum.ParentResourceType, parentID int64) (int64, error)
- func (s *PrincipalOrmStore) CountServices(ctx context.Context) (int64, error)
- func (s *PrincipalOrmStore) CountUsers(ctx context.Context, opts *types.UserFilter) (int64, error)
- func (s *PrincipalOrmStore) CreateService(ctx context.Context, svc *types.Service) error
- func (s *PrincipalOrmStore) CreateServiceAccount(ctx context.Context, sa *types.ServiceAccount) error
- func (s *PrincipalOrmStore) CreateUser(ctx context.Context, user *types.User) error
- func (s *PrincipalOrmStore) DeleteService(ctx context.Context, id int64) error
- func (s *PrincipalOrmStore) DeleteServiceAccount(ctx context.Context, id int64) error
- func (s *PrincipalOrmStore) DeleteUser(ctx context.Context, id int64) error
- func (s *PrincipalOrmStore) Find(ctx context.Context, id int64) (*types.Principal, error)
- func (s *PrincipalOrmStore) FindByEmail(ctx context.Context, email string) (*types.Principal, error)
- func (s *PrincipalOrmStore) FindByUID(ctx context.Context, uid string) (*types.Principal, error)
- func (s *PrincipalOrmStore) FindManyByUID(ctx context.Context, uids []string) ([]*types.Principal, error)
- func (s *PrincipalOrmStore) FindService(ctx context.Context, id int64) (*types.Service, error)
- func (s *PrincipalOrmStore) FindServiceAccount(ctx context.Context, id int64) (*types.ServiceAccount, error)
- func (s *PrincipalOrmStore) FindServiceAccountByUID(ctx context.Context, uid string) (*types.ServiceAccount, error)
- func (s *PrincipalOrmStore) FindServiceByUID(ctx context.Context, uid string) (*types.Service, error)
- func (s *PrincipalOrmStore) FindUser(ctx context.Context, id int64) (*types.User, error)
- func (s *PrincipalOrmStore) FindUserByEmail(ctx context.Context, email string) (*types.User, error)
- func (s *PrincipalOrmStore) FindUserByUID(ctx context.Context, uid string) (*types.User, error)
- func (s *PrincipalOrmStore) List(ctx context.Context, opts *types.PrincipalFilter) ([]*types.Principal, error)
- func (s *PrincipalOrmStore) ListServiceAccounts(ctx context.Context, parentType enum.ParentResourceType, parentID int64) ([]*types.ServiceAccount, error)
- func (s *PrincipalOrmStore) ListServices(ctx context.Context) ([]*types.Service, error)
- func (s *PrincipalOrmStore) ListUsers(ctx context.Context, opts *types.UserFilter) ([]*types.User, error)
- func (s *PrincipalOrmStore) UpdateService(ctx context.Context, svc *types.Service) error
- func (s *PrincipalOrmStore) UpdateServiceAccount(ctx context.Context, sa *types.ServiceAccount) error
- func (s *PrincipalOrmStore) UpdateUser(ctx context.Context, usr *types.User) error
- type TokenStore
- func (s *TokenStore) Count(ctx context.Context, principalID int64, tokenType enum.TokenType) (int64, error)
- func (s *TokenStore) Create(ctx context.Context, token *types.Token) error
- func (s *TokenStore) Delete(ctx context.Context, id int64) error
- func (s *TokenStore) DeleteExpiredBefore(ctx context.Context, before time.Time, tknTypes []enum.TokenType) (int64, error)
- func (s *TokenStore) Find(ctx context.Context, id int64) (*types.Token, error)
- func (s *TokenStore) FindByIdentifier(ctx context.Context, principalID int64, identifier string) (*types.Token, error)
- func (s *TokenStore) List(ctx context.Context, principalID int64, tokenType enum.TokenType) ([]*types.Token, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapToInfo ¶
func MapToInfo(p *Info) types.PrincipalInfo
Types ¶
type Info ¶
type Info struct { ID int64 `gorm:"column:principal_id;primaryKey"` UID string `gorm:"column:principal_uid"` DisplayName string `gorm:"column:principal_display_name"` Email string `gorm:"column:principal_email"` Type enum.PrincipalType `gorm:"column:principal_type"` Created int64 `gorm:"column:principal_created"` Updated int64 `gorm:"column:principal_updated"` }
type InfoView ¶
type InfoView struct {
// contains filtered or unexported fields
}
func NewPrincipalOrmInfoView ¶
NewPrincipalOrmInfoView returns a new InfoView. It's used by the principal info cache.
type PrincipalOrmStore ¶
type PrincipalOrmStore struct {
// contains filtered or unexported fields
}
PrincipalOrmStore implements a PrincipalStore backed by a relational database.
func NewPrincipalOrmStore ¶
func NewPrincipalOrmStore(db *gorm.DB, uidTransformation store.PrincipalUIDTransformation) *PrincipalOrmStore
NewPrincipalOrmStore returns a new PrincipalStoreOrm.
func (*PrincipalOrmStore) CountServiceAccounts ¶
func (s *PrincipalOrmStore) CountServiceAccounts(ctx context.Context, parentType enum.ParentResourceType, parentID int64) (int64, error)
CountServiceAccounts returns a count of service accounts for a specific parent.
func (*PrincipalOrmStore) CountServices ¶
func (s *PrincipalOrmStore) CountServices(ctx context.Context) (int64, error)
CountServices returns a count of service for a specific parent.
func (*PrincipalOrmStore) CountUsers ¶
func (s *PrincipalOrmStore) CountUsers(ctx context.Context, opts *types.UserFilter) (int64, error)
CountUsers returns a count of users matching the given filter.
func (*PrincipalOrmStore) CreateService ¶
CreateService saves the service.
func (*PrincipalOrmStore) CreateServiceAccount ¶
func (s *PrincipalOrmStore) CreateServiceAccount(ctx context.Context, sa *types.ServiceAccount) error
CreateServiceAccount saves the service account.
func (*PrincipalOrmStore) CreateUser ¶
CreateUser saves the user details.
func (*PrincipalOrmStore) DeleteService ¶
func (s *PrincipalOrmStore) DeleteService(ctx context.Context, id int64) error
DeleteService deletes the service.
func (*PrincipalOrmStore) DeleteServiceAccount ¶
func (s *PrincipalOrmStore) DeleteServiceAccount(ctx context.Context, id int64) error
DeleteServiceAccount deletes the service account.
func (*PrincipalOrmStore) DeleteUser ¶
func (s *PrincipalOrmStore) DeleteUser(ctx context.Context, id int64) error
DeleteUser deletes the user.
func (*PrincipalOrmStore) FindByEmail ¶
func (s *PrincipalOrmStore) FindByEmail(ctx context.Context, email string) (*types.Principal, error)
FindByEmail finds the principal by email.
func (*PrincipalOrmStore) FindManyByUID ¶
func (s *PrincipalOrmStore) FindManyByUID(ctx context.Context, uids []string) ([]*types.Principal, error)
FindManyByUID returns all principals found for the provided UIDs. If a UID isn't found, it's not returned in the list.
func (*PrincipalOrmStore) FindService ¶
FindService finds the service by id.
func (*PrincipalOrmStore) FindServiceAccount ¶
func (s *PrincipalOrmStore) FindServiceAccount(ctx context.Context, id int64) (*types.ServiceAccount, error)
FindServiceAccount finds the service account by id.
func (*PrincipalOrmStore) FindServiceAccountByUID ¶
func (s *PrincipalOrmStore) FindServiceAccountByUID(ctx context.Context, uid string) (*types.ServiceAccount, error)
FindServiceAccountByUID finds the service account by uid.
func (*PrincipalOrmStore) FindServiceByUID ¶
func (s *PrincipalOrmStore) FindServiceByUID(ctx context.Context, uid string) (*types.Service, error)
FindServiceByUID finds the service by uid.
func (*PrincipalOrmStore) FindUserByEmail ¶
FindUserByEmail finds the user by email.
func (*PrincipalOrmStore) FindUserByUID ¶
FindUserByUID finds the user by uid.
func (*PrincipalOrmStore) List ¶
func (s *PrincipalOrmStore) List(ctx context.Context, opts *types.PrincipalFilter) ([]*types.Principal, error)
List lists the principals matching the provided filter.
func (*PrincipalOrmStore) ListServiceAccounts ¶
func (s *PrincipalOrmStore) ListServiceAccounts(ctx context.Context, parentType enum.ParentResourceType, parentID int64) ([]*types.ServiceAccount, error)
ListServiceAccounts returns a list of service accounts for a specific parent.
func (*PrincipalOrmStore) ListServices ¶
ListServices returns a list of service for a specific parent.
func (*PrincipalOrmStore) ListUsers ¶
func (s *PrincipalOrmStore) ListUsers(ctx context.Context, opts *types.UserFilter) ([]*types.User, error)
ListUsers returns a list of users.
func (*PrincipalOrmStore) UpdateService ¶
UpdateService updates the service.
func (*PrincipalOrmStore) UpdateServiceAccount ¶
func (s *PrincipalOrmStore) UpdateServiceAccount(ctx context.Context, sa *types.ServiceAccount) error
UpdateServiceAccount updates the service account details.
func (*PrincipalOrmStore) UpdateUser ¶
UpdateUser updates an existing user.
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
TokenStore implements a TokenStore backed by a relational database.
func NewTokenOrmStore ¶
func NewTokenOrmStore(db *gorm.DB) *TokenStore
NewTokenOrmStore returns a new TokenStore.
func (*TokenStore) Count ¶
func (s *TokenStore) Count(ctx context.Context, principalID int64, tokenType enum.TokenType) (int64, error)
Count returns a count of tokens of a specifc type for a specific principal.
func (*TokenStore) Delete ¶
func (s *TokenStore) Delete(ctx context.Context, id int64) error
Delete deletes the token with the given id.
func (*TokenStore) DeleteExpiredBefore ¶
func (s *TokenStore) DeleteExpiredBefore( ctx context.Context, before time.Time, tknTypes []enum.TokenType, ) (int64, error)
DeleteExpiredBefore deletes all tokens that expired before the provided time. If tokenTypes are provided, then only tokens of that type are deleted.
func (*TokenStore) FindByIdentifier ¶
func (s *TokenStore) FindByIdentifier(ctx context.Context, principalID int64, identifier string) (*types.Token, error)
FindByIdentifier finds the token by principalId and token identifier.