Documentation
¶
Index ¶
- Constants
- type AuthenticatedIdentity
- type CredentialRecord
- type FreeIdentity
- type IdentityRecord
- type IdentityRepository
- func (repo *IdentityRepository) CreateIdentity(tx *sql.Tx, versionBy string, id string, name string) (*IdentityRecord, error)
- func (repo *IdentityRepository) CreatePasswordCredential(tx *sql.Tx, versionBy string, identity string, hash []byte) (*CredentialRecord, error)
- func (repo *IdentityRepository) DeleteExpiredFreeIdentities(tx *sql.Tx, id string) error
- func (repo *IdentityRepository) FindCredentialCount(tx *sql.Tx) (int, error)
- func (repo *IdentityRepository) FindFreeIdentities(tx *sql.Tx) ([]*IdentityRecord, error)
- func (repo *IdentityRepository) FindFreeIdentityById(tx *sql.Tx, id string) (*IdentityRecord, error)
- func (repo *IdentityRepository) FindIdentityById(tx *sql.Tx, id string) (*IdentityRecord, error)
- func (repo *IdentityRepository) FindPasswordCredentialByIdentityName(tx *sql.Tx, name string) (*PasswordCredentialRecord, error)
- func (repo *IdentityRepository) UpdateIdentityName(tx *sql.Tx, id string, name string) (*IdentityRecord, error)
- type IdentityService
- type PasswordCredentialRecord
Constants ¶
View Source
const ( FREE_IDENTITY_LIFETIME = 10 * 24 * time.Hour // 10 days GARBAGE_COLLECTOR_INTERVAL = 2 * time.Minute )
TODO: move this to a config value
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticatedIdentity ¶
type CredentialRecord ¶
type CredentialRecord struct {
Id string
}
type FreeIdentity ¶
type IdentityRecord ¶
type IdentityRepository ¶
type IdentityRepository struct {
// contains filtered or unexported fields
}
func NewRepo ¶
func NewRepo(db database.Database) *IdentityRepository
func (*IdentityRepository) CreateIdentity ¶
func (repo *IdentityRepository) CreateIdentity( tx *sql.Tx, versionBy string, id string, name string, ) (*IdentityRecord, error)
func (*IdentityRepository) CreatePasswordCredential ¶
func (repo *IdentityRepository) CreatePasswordCredential( tx *sql.Tx, versionBy string, identity string, hash []byte, ) (*CredentialRecord, error)
func (*IdentityRepository) DeleteExpiredFreeIdentities ¶
func (repo *IdentityRepository) DeleteExpiredFreeIdentities(tx *sql.Tx, id string) error
func (*IdentityRepository) FindCredentialCount ¶
func (repo *IdentityRepository) FindCredentialCount(tx *sql.Tx) (int, error)
func (*IdentityRepository) FindFreeIdentities ¶
func (repo *IdentityRepository) FindFreeIdentities(tx *sql.Tx) ([]*IdentityRecord, error)
func (*IdentityRepository) FindFreeIdentityById ¶
func (repo *IdentityRepository) FindFreeIdentityById(tx *sql.Tx, id string) (*IdentityRecord, error)
func (*IdentityRepository) FindIdentityById ¶
func (repo *IdentityRepository) FindIdentityById(tx *sql.Tx, id string) (*IdentityRecord, error)
func (*IdentityRepository) FindPasswordCredentialByIdentityName ¶
func (repo *IdentityRepository) FindPasswordCredentialByIdentityName( tx *sql.Tx, name string, ) (*PasswordCredentialRecord, error)
func (*IdentityRepository) UpdateIdentityName ¶
func (repo *IdentityRepository) UpdateIdentityName(tx *sql.Tx, id string, name string) (*IdentityRecord, error)
type IdentityService ¶
type IdentityService interface {
EnsureInitialIdentity() error
CreateFreeIdentity(session session.Session) (*FreeIdentity, error)
AuthenticateByNameAndPassword(name string, password string) (*AuthenticatedIdentity, error)
FindFreeIdentities(session session.Session) ([]*FreeIdentity, error)
FindFreeIdentityById(session session.Session, id *common.Ulid) (*FreeIdentity, error)
RegisterWithNameAndPassword(
session session.Session,
freeId *common.Ulid,
name string,
password string,
) (*AuthenticatedIdentity, error)
FindIdentityNameById(session session.Session, id *common.Ulid) (string, error)
}
func NewService ¶
func NewService(repo *IdentityRepository) (IdentityService, common.Initializer)
Click to show internal directories.
Click to hide internal directories.