Documentation ¶
Index ¶
- Variables
- func NewID() string
- func Version() map[string]interface{}
- type APIKey
- type APIKeyBundle
- type AttestationObject
- type AttestationStatement
- type AuthData
- type ClientData
- type CredentialData
- type CreditCard
- type CreditCardAssociation
- type CreditCardIssuer
- type Database
- func (db *Database) AddAPIKey(r *requests.Request) error
- func (db *Database) AddMfaToken(r *requests.Request) error
- func (db *Database) AddPublicKey(r *requests.Request) error
- func (db *Database) AddUser(r *requests.Request) error
- func (db *Database) AuthenticateUser(r *requests.Request) error
- func (db *Database) ChangeUserPassword(r *requests.Request) error
- func (db *Database) Copy(fp string) error
- func (db *Database) DeleteAPIKey(r *requests.Request) error
- func (db *Database) DeleteMfaToken(r *requests.Request) error
- func (db *Database) DeletePublicKey(r *requests.Request) error
- func (db *Database) DeleteUser(r *requests.Request) error
- func (db *Database) GetAPIKeys(r *requests.Request) error
- func (db *Database) GetAdminUserCount() int
- func (db *Database) GetMfaTokens(r *requests.Request) error
- func (db *Database) GetPasswordPolicyRegex() string
- func (db *Database) GetPasswordPolicySummary() string
- func (db *Database) GetPath() string
- func (db *Database) GetPublicKeys(r *requests.Request) error
- func (db *Database) GetUser(r *requests.Request) error
- func (db *Database) GetUserCount() int
- func (db *Database) GetUsernamePolicyRegex() string
- func (db *Database) GetUsernamePolicySummary() string
- func (db *Database) GetUsers(r *requests.Request) error
- func (db *Database) IdentifyUser(r *requests.Request) error
- func (db *Database) LookupAPIKey(r *requests.Request) error
- func (db *Database) Save() error
- func (db *Database) UpdateUserPassword(r *requests.Request) error
- func (db *Database) UserExists(username, emailAddress string) (bool, error)
- type Device
- type EmailAddress
- type Handle
- type Image
- type Location
- type LockoutState
- type MfaDevice
- type MfaToken
- type MfaTokenBundle
- type Name
- type Organization
- type Password
- type PasswordPolicy
- type Policy
- type PublicKey
- type PublicKeyBundle
- type Registration
- type Role
- type User
- func (user *User) AddAPIKey(r *requests.Request) error
- func (user *User) AddEmailAddress(s string) error
- func (user *User) AddMfaToken(r *requests.Request) error
- func (user *User) AddName(name *Name) error
- func (user *User) AddPassword(s string, keepVersions int) error
- func (user *User) AddPublicKey(r *requests.Request) error
- func (user *User) AddRole(s string) error
- func (user *User) AddRoles(roles []string) error
- func (user *User) ChangePassword(r *requests.Request, keepVersions int) error
- func (user *User) DeleteAPIKey(r *requests.Request) error
- func (user *User) DeleteMfaToken(r *requests.Request) error
- func (user *User) DeletePublicKey(r *requests.Request) error
- func (user *User) GetChallenges() []string
- func (user *User) GetFlags(r *requests.Request)
- func (user *User) GetFullName() string
- func (user *User) GetMailClaim() string
- func (user *User) GetMetadata() *UserMetadata
- func (user *User) GetNameClaim() string
- func (user *User) GetRolesClaim() []string
- func (user *User) HasAdminRights() bool
- func (user *User) HasEmailAddresses() bool
- func (user *User) HasRole(s string) bool
- func (user *User) HasRoles() bool
- func (user *User) LookupAPIKey(r *requests.Request) error
- func (user *User) Revise()
- func (user *User) UpdatePassword(r *requests.Request, keepVersions int) error
- func (user *User) Valid() error
- func (user *User) VerifyPassword(s string) error
- func (user *User) VerifyWebAuthnRequest(r *requests.Request) error
- type UserMetadata
- type UserMetadataBundle
- type UserPolicy
- type WebAuthnAuthenticateRequest
- type WebAuthnRegisterRequest
Constants ¶
This section is empty.
Variables ¶
var CreditCardAssociations = []*CreditCardAssociation{ { Name: "American Express", CodeName: "CID", CodeFormat: "NNNN", Aliases: []string{ "amex", "AMEX", }, }, { Name: "Diners Club", Aliases: []string{ "diners", }, CodeName: "Security Code", CodeFormat: "NNN", }, { Name: "Discover", Aliases: []string{ "discover", }, CodeName: "CID", CodeFormat: "NNN", }, { Name: "Mastercard", Aliases: []string{ "mastercard", }, CodeName: "CVC2", CodeFormat: "NNN", }, { Name: "Visa", Aliases: []string{ "visa", }, CodeName: "CVC2", CodeFormat: "NNN", }, }
CreditCardAssociations is a collection of most popular credit card issuers.
var CreditCardIssuers = []*CreditCardIssuer{}
CreditCardIssuers is a collection of most popular credit card issuers.
Functions ¶
Types ¶
type APIKey ¶
type APIKey struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Prefix string `json:"prefix,omitempty" xml:"prefix,omitempty" yaml:"prefix,omitempty"` Usage string `json:"usage,omitempty" xml:"usage,omitempty" yaml:"usage,omitempty"` Comment string `json:"comment,omitempty" xml:"comment,omitempty" yaml:"comment,omitempty"` Payload string `json:"payload,omitempty" xml:"payload,omitempty" yaml:"payload,omitempty"` Expired bool `json:"expired,omitempty" xml:"expired,omitempty" yaml:"expired,omitempty"` ExpiredAt time.Time `json:"expired_at,omitempty" xml:"expired_at,omitempty" yaml:"expired_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty" xml:"created_at,omitempty" yaml:"created_at,omitempty"` Disabled bool `json:"disabled,omitempty" xml:"disabled,omitempty" yaml:"disabled,omitempty"` DisabledAt time.Time `json:"disabled_at,omitempty" xml:"disabled_at,omitempty" yaml:"disabled_at,omitempty"` }
APIKey is an API key.
type APIKeyBundle ¶
type APIKeyBundle struct {
// contains filtered or unexported fields
}
APIKeyBundle is a collection of API keys.
func NewAPIKeyBundle ¶
func NewAPIKeyBundle() *APIKeyBundle
NewAPIKeyBundle returns an instance of APIKeyBundle.
func (*APIKeyBundle) Get ¶
func (b *APIKeyBundle) Get() []*APIKey
Get returns APIKey instances of the APIKeyBundle.
func (*APIKeyBundle) Size ¶
func (b *APIKeyBundle) Size() int
Size returns the number of APIKey instances in APIKeyBundle.
type AttestationObject ¶
type AttestationObject struct { AttestationStatement *AttestationStatement `json:"attStmt,omitempty" xml:"attStmt,omitempty" yaml:"attStmt,omitempty"` AuthData *AuthData `json:"authData,omitempty" xml:"authData,omitempty" yaml:"authData,omitempty"` Format string `json:"fmt,omitempty" xml:"fmt,omitempty" yaml:"fmt,omitempty"` }
AttestationObject is Webauthn AttestationObject.
type AttestationStatement ¶
type AttestationStatement struct { Algorithm int64 `json:"alg,omitempty" xml:"alg,omitempty" yaml:"alg,omitempty"` Signature string `json:"sig,omitempty" xml:"sig,omitempty" yaml:"sig,omitempty"` // The string in the first element of the slice contains the certificate associates // with the authenticaing device. The following commands allow the viewing of the // cerificate. The Subject contains the serial number associated with the device. // 1. `echo -n "base64 encoded value" | base64 -d > key.crt` // 2. `openssl x509 -in key.crt -inform der -text` Certificates []string `json:"x5c,omitempty" xml:"x5c,omitempty" yaml:"x5c,omitempty"` }
AttestationStatement is AttestationStatement of the Webauthn AttestationObject.
type AuthData ¶
type AuthData struct { RelyingPartyID string `json:"rpIdHash,omitempty" xml:"rpIdHash,omitempty" yaml:"rpIdHash,omitempty"` Flags map[string]bool `json:"flags,omitempty" xml:"flags,omitempty" yaml:"flags,omitempty"` SignatureCounter uint32 `json:"signatureCounter,omitempty" xml:"signatureCounter,omitempty" yaml:"signatureCounter,omitempty"` Extensions interface{} `json:"extensions,omitempty" xml:"extensions,omitempty" yaml:"extensions,omitempty"` CredentialData *CredentialData `json:"credentialData,omitempty" xml:"credentialData,omitempty" yaml:"credentialData,omitempty"` }
AuthData is AuthData of the Webauthn AttestationObject.
type ClientData ¶
type ClientData struct { Challenge string `json:"challenge,omitempty" xml:"challenge,omitempty" yaml:"challenge,omitempty"` CrossOrigin bool `json:"crossOrigin,omitempty" xml:"crossOrigin,omitempty" yaml:"crossOrigin,omitempty"` Origin string `json:"origin,omitempty" xml:"origin,omitempty" yaml:"origin,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` }
ClientData represents the contextual bindings of both the WebAuthn Relying Party and the client. It is a key-value mapping whose keys are strings. Values can be any type that has a valid encoding in JSON. Its structure is defined by the following Web IDL.
type CredentialData ¶
type CredentialData struct { // The AAGUID of the authenticator. AAGUID string `json:"aaguid,omitempty" xml:"aaguid,omitempty" yaml:"aaguid,omitempty"` // A probabilistically-unique byte sequence identifying a public key credential source and its authentication assertions. CredentialID string `json:"credentialId,omitempty" xml:"credentialId,omitempty" yaml:"credentialId,omitempty"` // The credential public key encoded in COSE Key format PublicKey map[string]interface{} `json:"publicKey,omitempty" xml:"publicKey,omitempty" yaml:"publicKey,omitempty"` }
CredentialData is attested credential data. It is a variable-length byte array added to the authenticator data when generating an attestation object for a given credential.
type CreditCard ¶
type CreditCard struct { Number string `json:"number,omitempty" xml:"number,omitempty" yaml:"number,omitempty"` Issuer *CreditCardIssuer `json:"issuer,omitempty" xml:"issuer,omitempty" yaml:"issuer,omitempty"` Association *CreditCardAssociation `json:"association,omitempty" xml:"association,omitempty" yaml:"association,omitempty"` Code string `json:"code,omitempty" xml:"code,omitempty" yaml:"code,omitempty"` ExpiresAt time.Time `json:"expires_at,omitempty" xml:"expires_at,omitempty" yaml:"expires_at,omitempty"` IssuedAt time.Time `json:"issued_at,omitempty" xml:"issued_at,omitempty" yaml:"issued_at,omitempty"` }
CreditCard represents a credit card.
func NewCreditCard ¶
func NewCreditCard() *CreditCard
NewCreditCard returns an instance of CreditCard
func (*CreditCard) AddAssociation ¶
func (cc *CreditCard) AddAssociation(s string) error
AddAssociation adds the name of the association, e.g. Visa, American Express, etc., to a credit card
func (*CreditCard) AddIssuer ¶
func (cc *CreditCard) AddIssuer(s string) error
AddIssuer adds the name of the issuer, e.g. CitiGroup, CapitalOne, etc.
type CreditCardAssociation ¶
type CreditCardAssociation struct { Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Aliases []string `json:"aliases,omitempty" xml:"aliases,omitempty" yaml:"aliases,omitempty"` CodeName string `json:"code_name,omitempty" xml:"code_name,omitempty" yaml:"code_name,omitempty"` CodeFormat string `json:"code_format,omitempty" xml:"code_format,omitempty" yaml:"code_format,omitempty"` }
CreditCardAssociation represents a credit card association, e.g. Visa, American Express, etc., to a credit card
func NewCreditCardAssociation ¶
func NewCreditCardAssociation() *CreditCardAssociation
NewCreditCardAssociation returns an instance of
type CreditCardIssuer ¶
type CreditCardIssuer struct { Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Aliases []string `json:"aliases,omitempty" xml:"aliases,omitempty" yaml:"aliases,omitempty"` }
CreditCardIssuer represents the issuer, e.g. Visa, American Express, etc.
func NewCreditCardIssuer ¶
func NewCreditCardIssuer() *CreditCardIssuer
NewCreditCardIssuer returns an instance of
type Database ¶
type Database struct { Version string `json:"version,omitempty" xml:"version,omitempty" yaml:"version,omitempty"` Policy Policy `json:"policy,omitempty" xml:"policy,omitempty" yaml:"policy,omitempty"` Revision uint64 `json:"revision,omitempty" xml:"revision,omitempty" yaml:"revision,omitempty"` LastModified time.Time `json:"last_modified,omitempty" xml:"last_modified,omitempty" yaml:"last_modified,omitempty"` Users []*User `json:"users,omitempty" xml:"users,omitempty" yaml:"users,omitempty"` // contains filtered or unexported fields }
Database is user identity database.
func NewDatabase ¶
NewDatabase return an instance of Database.
func (*Database) AddMfaToken ¶
AddMfaToken adds MFA token for a user.
func (*Database) AddPublicKey ¶
AddPublicKey adds public key, e.g. GPG or SSH, for a user.
func (*Database) AuthenticateUser ¶
AuthenticateUser adds user identity to the database.
func (*Database) ChangeUserPassword ¶
ChangeUserPassword change user password.
func (*Database) DeleteAPIKey ¶
DeleteAPIKey deletes an API key associated with a user by key id.
func (*Database) DeleteMfaToken ¶
DeleteMfaToken deletes MFA token associated with a user by token id.
func (*Database) DeletePublicKey ¶
DeletePublicKey deletes a public key associated with a user by key id.
func (*Database) DeleteUser ¶
DeleteUser deletes a user by user id.
func (*Database) GetAPIKeys ¶
GetAPIKeys returns a list of API keys associated with a user.
func (*Database) GetAdminUserCount ¶
GetAdminUserCount returns user count.
func (*Database) GetMfaTokens ¶
GetMfaTokens returns a list of MFA tokens associated with a user.
func (*Database) GetPasswordPolicyRegex ¶
GetPasswordPolicyRegex returns regex for passwords.
func (*Database) GetPasswordPolicySummary ¶
GetPasswordPolicySummary returns the summary of password policy.
func (*Database) GetPublicKeys ¶
GetPublicKeys returns a list of public keys associated with a user.
func (*Database) GetUserCount ¶
GetUserCount returns user count.
func (*Database) GetUsernamePolicyRegex ¶
GetUsernamePolicyRegex returns regex for usernames.
func (*Database) GetUsernamePolicySummary ¶
GetUsernamePolicySummary returns the summary of username policy.
func (*Database) IdentifyUser ¶
IdentifyUser returns user identity and a list of challenges that should be satisfied prior to successfully authenticating a user.
func (*Database) LookupAPIKey ¶
LookupAPIKey returns username and email associated with the provided API key.
func (*Database) UpdateUserPassword ¶
UpdateUserPassword change user password.
type Device ¶
type Device struct { Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` }
Device is the hardware device on which the WebAuthn Client runs, for example a smartphone, a laptop computer or a desktop computer, and the operating system running on that hardware.
type EmailAddress ¶
type EmailAddress struct { Address string `json:"address,omitempty" xml:"address,omitempty" yaml:"address,omitempty"` Confirmed bool `json:"confirmed,omitempty" xml:"confirmed,omitempty" yaml:"confirmed,omitempty"` Domain string `json:"domain,omitempty" xml:"domain,omitempty" yaml:"domain,omitempty"` // contains filtered or unexported fields }
EmailAddress is an instance of email address
func NewEmailAddress ¶
func NewEmailAddress(s string) (*EmailAddress, error)
NewEmailAddress returns an instance of EmailAddress.
func (*EmailAddress) Primary ¶
func (m *EmailAddress) Primary() bool
Primary returns true is the email is a primary email.
func (*EmailAddress) ToString ¶
func (m *EmailAddress) ToString() string
ToString returns string representation of an email address.
type Handle ¶
type Handle struct { Github string `json:"github,omitempty" xml:"github,omitempty" yaml:"github,omitempty"` Twitter string `json:"twitter,omitempty" xml:"twitter,omitempty" yaml:"twitter,omitempty"` }
Handle is the name associated with online services, e.g. Github, Twitter, etc.
type Image ¶
type Image struct { Title string `json:"title,omitempty" xml:"title,omitempty" yaml:"title,omitempty"` // Encoded Base64 string Body string `json:"body,omitempty" xml:"body,omitempty" yaml:"body,omitempty"` Config image.Config `json:"config,omitempty" xml:"config,omitempty" yaml:"config,omitempty"` Path string `json:"path,omitempty" xml:"path,omitempty" yaml:"path,omitempty"` }
Image is base64 image
type Location ¶
type Location struct { Street string `json:"street,omitempty" xml:"street,omitempty" yaml:"street,omitempty"` City string `json:"city,omitempty" xml:"city,omitempty" yaml:"city,omitempty"` State string `json:"state,omitempty" xml:"state,omitempty" yaml:"state,omitempty"` ZipCode string `json:"zip_code,omitempty" xml:"zip_code,omitempty" yaml:"zip_code,omitempty"` Confirmed bool `json:"confirmed,omitempty" xml:"confirmed,omitempty" yaml:"confirmed,omitempty"` Current bool `json:"current,omitempty" xml:"current,omitempty" yaml:"current,omitempty"` Domicile bool `json:"domicile,omitempty" xml:"domicile,omitempty" yaml:"domicile,omitempty"` Residential bool `json:"residential,omitempty" xml:"residential,omitempty" yaml:"residential,omitempty"` Commercial bool `json:"commercial,omitempty" xml:"commercial,omitempty" yaml:"commercial,omitempty"` }
Location repsents a location, e.g. street address.
type LockoutState ¶
type LockoutState struct { Enabled bool `json:"enabled,omitempty" xml:"enabled,omitempty" yaml:"enabled,omitempty"` StartTime time.Time `json:"start_time,omitempty" xml:"start_time,omitempty" yaml:"start_time,omitempty"` EndTime time.Time `json:"end_time,omitempty" xml:"end_time,omitempty" yaml:"end_time,omitempty"` }
LockoutState indicates whether user identity is temporarily disabled. If the identity is lockedout, when does the lockout end.
func NewLockoutState ¶
func NewLockoutState() *LockoutState
NewLockoutState returns an instance of LockoutState.
type MfaDevice ¶
type MfaDevice struct { Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Vendor string `json:"vendor,omitempty" xml:"vendor,omitempty" yaml:"vendor,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` }
MfaDevice is the hardware device associated with MfaToken.
type MfaToken ¶
type MfaToken struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` Algorithm string `json:"algorithm,omitempty" xml:"algorithm,omitempty" yaml:"algorithm,omitempty"` Comment string `json:"comment,omitempty" xml:"comment,omitempty" yaml:"comment,omitempty"` Secret string `json:"secret,omitempty" xml:"secret,omitempty" yaml:"secret,omitempty"` Period int `json:"period,omitempty" xml:"period,omitempty" yaml:"period,omitempty"` Digits int `json:"digits,omitempty" xml:"digits,omitempty" yaml:"digits,omitempty"` Expired bool `json:"expired,omitempty" xml:"expired,omitempty" yaml:"expired,omitempty"` ExpiredAt time.Time `json:"expired_at,omitempty" xml:"expired_at,omitempty" yaml:"expired_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty" xml:"created_at,omitempty" yaml:"created_at,omitempty"` Disabled bool `json:"disabled,omitempty" xml:"disabled,omitempty" yaml:"disabled,omitempty"` DisabledAt time.Time `json:"disabled_at,omitempty" xml:"disabled_at,omitempty" yaml:"disabled_at,omitempty"` Device *MfaDevice `json:"device,omitempty" xml:"device,omitempty" yaml:"device,omitempty"` Parameters map[string]string `json:"parameters,omitempty" xml:"parameters,omitempty" yaml:"parameters,omitempty"` Flags map[string]bool `json:"flags,omitempty" xml:"flags,omitempty" yaml:"flags,omitempty"` SignatureCounter uint32 `json:"signature_counter,omitempty" xml:"signature_counter,omitempty" yaml:"signature_counter,omitempty"` // contains filtered or unexported fields }
MfaToken is a puiblic key in a public-private key pair.
func NewMfaToken ¶
NewMfaToken returns an instance of MfaToken.
func (*MfaToken) ValidateCode ¶
ValidateCode validates a passcode
func (*MfaToken) ValidateCodeWithTime ¶
ValidateCodeWithTime validates a passcode at a particular time.
func (*MfaToken) WebAuthnRequest ¶
func (p *MfaToken) WebAuthnRequest(payload string) (*WebAuthnAuthenticateRequest, error)
WebAuthnRequest processes WebAuthn requests.
type MfaTokenBundle ¶
type MfaTokenBundle struct {
// contains filtered or unexported fields
}
MfaTokenBundle is a collection of public keys.
func NewMfaTokenBundle ¶
func NewMfaTokenBundle() *MfaTokenBundle
NewMfaTokenBundle returns an instance of MfaTokenBundle.
func (*MfaTokenBundle) Add ¶
func (b *MfaTokenBundle) Add(k *MfaToken)
Add adds MfaToken to MfaTokenBundle.
func (*MfaTokenBundle) Get ¶
func (b *MfaTokenBundle) Get() []*MfaToken
Get returns MfaToken instances of the MfaTokenBundle.
func (*MfaTokenBundle) Size ¶
func (b *MfaTokenBundle) Size() int
Size returns the number of MfaToken instances in MfaTokenBundle.
type Name ¶
type Name struct { First string `json:"first,omitempty" xml:"first,omitempty" yaml:"first,omitempty"` Last string `json:"last,omitempty" xml:"last,omitempty" yaml:"last,omitempty"` Middle string `json:"middle,omitempty" xml:"middle,omitempty" yaml:"middle,omitempty"` Preferred string `json:"preferred,omitempty" xml:"preferred,omitempty" yaml:"preferred,omitempty"` Nickname bool `json:"nickname,omitempty" xml:"nickname,omitempty" yaml:"nickname,omitempty"` Confirmed bool `json:"confirmed,omitempty" xml:"confirmed,omitempty" yaml:"confirmed,omitempty"` Primary bool `json:"primary,omitempty" xml:"primary,omitempty" yaml:"primary,omitempty"` Legal bool `json:"legal,omitempty" xml:"legal,omitempty" yaml:"legal,omitempty"` Alias bool `json:"alias,omitempty" xml:"alias,omitempty" yaml:"alias,omitempty"` }
Name represents human name
func (*Name) GetFullName ¶
GetFullName returns the primary full name for User.
func (*Name) GetNameClaim ¶
GetNameClaim returns name field of a claim.
type Organization ¶
type Organization struct { ID uint64 `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Aliases []string `json:"aliases,omitempty" xml:"aliases,omitempty" yaml:"aliases,omitempty"` }
Organization is an organized body of people with a particular purpose.
func NewOrganization ¶
func NewOrganization() *Organization
NewOrganization returns an instance of Organization.
type Password ¶
type Password struct { Purpose string `json:"purpose,omitempty" xml:"purpose,omitempty" yaml:"purpose,omitempty"` Algorithm string `json:"algorithm,omitempty" xml:"algorithm,omitempty" yaml:"algorithm,omitempty"` Hash string `json:"hash,omitempty" xml:"hash,omitempty" yaml:"hash,omitempty"` Cost int `json:"cost,omitempty" xml:"cost,omitempty" yaml:"cost,omitempty"` Expired bool `json:"expired,omitempty" xml:"expired,omitempty" yaml:"expired,omitempty"` ExpiredAt time.Time `json:"expired_at,omitempty" xml:"expired_at,omitempty" yaml:"expired_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty" xml:"created_at,omitempty" yaml:"created_at,omitempty"` Disabled bool `json:"disabled,omitempty" xml:"disabled,omitempty" yaml:"disabled,omitempty"` DisabledAt time.Time `json:"disabled_at,omitempty" xml:"disabled_at,omitempty" yaml:"disabled_at,omitempty"` }
Password is a memorized secret, typically a string of characters, used to confirm the identity of a user.
func NewPassword ¶
NewPassword returns an instance of Password.
type PasswordPolicy ¶
type PasswordPolicy struct { KeepVersions int `json:"keep_versions" xml:"keep_versions" yaml:"keep_versions"` MinLength int `json:"min_length" xml:"min_length" yaml:"min_length"` MaxLength int `json:"max_length" xml:"max_length" yaml:"max_length"` RequireUppercase bool `json:"require_uppercase" xml:"require_uppercase" yaml:"require_uppercase"` RequireLowercase bool `json:"require_lowercase" xml:"require_lowercase" yaml:"require_lowercase"` RequireNumber bool `json:"require_number" xml:"require_number" yaml:"require_number"` RequireNonAlphaNumeric bool `json:"require_non_alpha_numeric" xml:"require_non_alpha_numeric" yaml:"require_non_alpha_numeric"` BlockReuse bool `json:"block_reuse" xml:"block_reuse" yaml:"block_reuse"` BlockPasswordChange bool `json:"block_password_change" xml:"block_password_change" yaml:"block_password_change"` }
PasswordPolicy represents database password policy.
type Policy ¶
type Policy struct { Password PasswordPolicy `json:"password,omitempty" xml:"password,omitempty" yaml:"password,omitempty"` User UserPolicy `json:"user,omitempty" xml:"user,omitempty" yaml:"user,omitempty"` }
Policy represents database usage policy.
type PublicKey ¶
type PublicKey struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Usage string `json:"usage,omitempty" xml:"usage,omitempty" yaml:"usage,omitempty"` // Type is any of the following: dsa, rsa, ecdsa, ed25519 Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` Fingerprint string `json:"fingerprint,omitempty" xml:"fingerprint,omitempty" yaml:"fingerprint,omitempty"` FingerprintMD5 string `json:"fingerprint_md5,omitempty" xml:"fingerprint_md5,omitempty" yaml:"fingerprint_md5,omitempty"` Comment string `json:"comment,omitempty" xml:"comment,omitempty" yaml:"comment,omitempty"` Payload string `json:"payload,omitempty" xml:"payload,omitempty" yaml:"payload,omitempty"` OpenSSH string `json:"openssh,omitempty" xml:"openssh,omitempty" yaml:"openssh,omitempty"` Expired bool `json:"expired,omitempty" xml:"expired,omitempty" yaml:"expired,omitempty"` ExpiredAt time.Time `json:"expired_at,omitempty" xml:"expired_at,omitempty" yaml:"expired_at,omitempty"` CreatedAt time.Time `json:"created_at,omitempty" xml:"created_at,omitempty" yaml:"created_at,omitempty"` Disabled bool `json:"disabled,omitempty" xml:"disabled,omitempty" yaml:"disabled,omitempty"` DisabledAt time.Time `json:"disabled_at,omitempty" xml:"disabled_at,omitempty" yaml:"disabled_at,omitempty"` }
PublicKey is a puiblic key in a public-private key pair.
func NewPublicKey ¶
NewPublicKey returns an instance of PublicKey.
type PublicKeyBundle ¶
type PublicKeyBundle struct {
// contains filtered or unexported fields
}
PublicKeyBundle is a collection of public keys.
func NewPublicKeyBundle ¶
func NewPublicKeyBundle() *PublicKeyBundle
NewPublicKeyBundle returns an instance of PublicKeyBundle.
func (*PublicKeyBundle) Add ¶
func (b *PublicKeyBundle) Add(k *PublicKey)
Add adds PublicKey to PublicKeyBundle.
func (*PublicKeyBundle) Get ¶
func (b *PublicKeyBundle) Get() []*PublicKey
Get returns PublicKey instances of the PublicKeyBundle.
func (*PublicKeyBundle) Size ¶
func (b *PublicKeyBundle) Size() int
Size returns the number of PublicKey instances in PublicKeyBundle.
type Registration ¶
type Registration struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` CreatedAt time.Time `json:"created_at,omitempty" xml:"created_at,omitempty" yaml:"created_at,omitempty"` ApprovedAt time.Time `json:"approved_at,omitempty" xml:"approved_at,omitempty" yaml:"approved_at,omitempty"` Approved bool `json:"approved,omitempty" xml:"approved,omitempty" yaml:"approved,omitempty"` DeclinedAt time.Time `json:"declined_at,omitempty" xml:"declined_at,omitempty" yaml:"declined_at,omitempty"` Declined bool `json:"declined,omitempty" xml:"declined,omitempty" yaml:"declined,omitempty"` }
Registration is an instance of user registration. Typically used in scenarios where user wants to register for a service. The user provides identity information and waits for an approval.
func NewRegistration ¶
func NewRegistration(s string) *Registration
NewRegistration returns an instance of Registration.
type Role ¶
type Role struct { Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Organization string `json:"organization,omitempty" xml:"organization,omitempty" yaml:"organization,omitempty"` }
Role is the user role or entitlement in a system.
type User ¶
type User struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Enabled bool `json:"enabled,omitempty" xml:"enabled,omitempty" yaml:"enabled,omitempty"` Human bool `json:"human,omitempty" xml:"human,omitempty" yaml:"human,omitempty"` Username string `json:"username,omitempty" xml:"username,omitempty" yaml:"username,omitempty"` Title string `json:"title,omitempty" xml:"title,omitempty" yaml:"title,omitempty"` Name *Name `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Organization *Organization `json:"organization,omitempty" xml:"organization,omitempty" yaml:"organization,omitempty"` Names []*Name `json:"names,omitempty" xml:"names,omitempty" yaml:"names,omitempty"` Organizations []*Organization `json:"organizations,omitempty" xml:"organizations,omitempty" yaml:"organizations,omitempty"` StreetAddress []*Location `json:"street_address,omitempty" xml:"street_address,omitempty" yaml:"street_address,omitempty"` EmailAddress *EmailAddress `json:"email_address,omitempty" xml:"email_address,omitempty" yaml:"email_address,omitempty"` EmailAddresses []*EmailAddress `json:"email_addresses,omitempty" xml:"email_addresses,omitempty" yaml:"email_addresses,omitempty"` Passwords []*Password `json:"passwords,omitempty" xml:"passwords,omitempty" yaml:"passwords,omitempty"` PublicKeys []*PublicKey `json:"public_keys,omitempty" xml:"public_keys,omitempty" yaml:"public_keys,omitempty"` APIKeys []*APIKey `json:"api_keys,omitempty" xml:"api_keys,omitempty" yaml:"api_keys,omitempty"` MfaTokens []*MfaToken `json:"mfa_tokens,omitempty" xml:"mfa_tokens,omitempty" yaml:"mfa_tokens,omitempty"` Lockout *LockoutState `json:"lockout,omitempty" xml:"lockout,omitempty" yaml:"lockout,omitempty"` Avatar *Image `json:"avatar,omitempty" xml:"avatar,omitempty" yaml:"avatar,omitempty"` Created time.Time `json:"created,omitempty" xml:"created,omitempty" yaml:"created,omitempty"` LastModified time.Time `json:"last_modified,omitempty" xml:"last_modified,omitempty" yaml:"last_modified,omitempty"` Revision int `json:"revision,omitempty" xml:"revision,omitempty" yaml:"revision,omitempty"` Roles []*Role `json:"roles,omitempty" xml:"roles,omitempty" yaml:"roles,omitempty"` Registration *Registration `json:"registration,omitempty" xml:"registration,omitempty" yaml:"registration,omitempty"` // contains filtered or unexported fields }
User is a user identity.
func NewUserWithRoles ¶
NewUserWithRoles returns User with additional fields.
func (*User) AddEmailAddress ¶
AddEmailAddress returns creates and adds password for a user identity.
func (*User) AddMfaToken ¶
AddMfaToken adds MFA token to a user identity.
func (*User) AddPassword ¶
AddPassword returns creates and adds password for a user identity.
func (*User) AddPublicKey ¶
AddPublicKey adds public key, e.g. GPG or SSH, to a user identity.
func (*User) ChangePassword ¶
ChangePassword changes user password.
func (*User) DeleteAPIKey ¶
DeleteAPIKey deletes an API key associated with a user.
func (*User) DeleteMfaToken ¶
DeleteMfaToken deletes MFA token associated with a user.
func (*User) DeletePublicKey ¶
DeletePublicKey deletes a public key associated with a user.
func (*User) GetChallenges ¶
GetChallenges returns a list of challenges that should be satisfied prior to successfully authenticating a user.
func (*User) GetFullName ¶
GetFullName returns the primary full name for a user.
func (*User) GetMailClaim ¶
GetMailClaim returns primary email address.
func (*User) GetMetadata ¶
func (user *User) GetMetadata() *UserMetadata
GetMetadata returns user metadata.
func (*User) GetNameClaim ¶
GetNameClaim returns name field of a claim.
func (*User) GetRolesClaim ¶
GetRolesClaim returns name field of a claim.
func (*User) HasAdminRights ¶
HasAdminRights returns true if the user has admin rights.
func (*User) HasEmailAddresses ¶
HasEmailAddresses checks whether a user has email address.
func (*User) LookupAPIKey ¶
LookupAPIKey performs the lookup of API key.
func (*User) Revise ¶
func (user *User) Revise()
Revise increments revision number and last modified timestamp.
func (*User) UpdatePassword ¶
UpdatePassword update user password.
func (*User) VerifyPassword ¶
VerifyPassword verifies provided password matches to the one in the database.
type UserMetadata ¶
type UserMetadata struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Enabled bool `json:"enabled,omitempty" xml:"enabled,omitempty" yaml:"enabled,omitempty"` Username string `json:"username,omitempty" xml:"username,omitempty" yaml:"username,omitempty"` Title string `json:"title,omitempty" xml:"title,omitempty" yaml:"title,omitempty"` Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"` Email string `json:"email,omitempty" xml:"email,omitempty" yaml:"email,omitempty"` Created time.Time `json:"created,omitempty" xml:"created,omitempty" yaml:"created,omitempty"` LastModified time.Time `json:"last_modified,omitempty" xml:"last_modified,omitempty" yaml:"last_modified,omitempty"` Revision int `json:"revision,omitempty" xml:"revision,omitempty" yaml:"revision,omitempty"` Avatar string `json:"avatar,omitempty" xml:"avatar,omitempty" yaml:"avatar,omitempty"` }
UserMetadata is metadata associated with a user.
type UserMetadataBundle ¶
type UserMetadataBundle struct {
// contains filtered or unexported fields
}
UserMetadataBundle is a collection of public users.
func NewUserMetadataBundle ¶
func NewUserMetadataBundle() *UserMetadataBundle
NewUserMetadataBundle returns an instance of UserMetadataBundle.
func (*UserMetadataBundle) Add ¶
func (b *UserMetadataBundle) Add(k *UserMetadata)
Add adds UserMetadata to UserMetadataBundle.
func (*UserMetadataBundle) Get ¶
func (b *UserMetadataBundle) Get() []*UserMetadata
Get returns UserMetadata instances of the UserMetadataBundle.
func (*UserMetadataBundle) Size ¶
func (b *UserMetadataBundle) Size() int
Size returns the number of UserMetadata instances in UserMetadataBundle.
type UserPolicy ¶
type UserPolicy struct { MinLength int `json:"min_length" xml:"min_length" yaml:"min_length"` MaxLength int `json:"max_length" xml:"max_length" yaml:"max_length"` AllowNonAlphaNumeric bool `json:"allow_non_alpha_numeric" xml:"allow_non_alpha_numeric" yaml:"allow_non_alpha_numeric"` AllowUppercase bool `json:"allow_uppercase" xml:"allow_uppercase" yaml:"allow_uppercase"` }
UserPolicy represents database username policy
type WebAuthnAuthenticateRequest ¶
type WebAuthnAuthenticateRequest struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` AuthData *AuthData `json:"auth_data,omitempty" xml:"auth_data,omitempty" yaml:"auth_data,omitempty"` AuthDataEncoded string `json:"auth_data_encoded,omitempty" xml:"auth_data_encoded,omitempty" yaml:"auth_data_encoded,omitempty"` ClientData *ClientData `json:"client_data,omitempty" xml:"client_data,omitempty" yaml:"client_data,omitempty"` ClientDataEncoded string `json:"client_data_encoded,omitempty" xml:"client_data_encoded,omitempty" yaml:"client_data_encoded,omitempty"` Signature string `json:"signature,omitempty" xml:"signature,omitempty" yaml:"signature,omitempty"` SignatureEncoded string `json:"signature_encoded,omitempty" xml:"signature_encoded,omitempty" yaml:"signature_encoded,omitempty"` // contains filtered or unexported fields }
WebAuthnAuthenticateRequest represents Webauthn Authentication request.
type WebAuthnRegisterRequest ¶
type WebAuthnRegisterRequest struct { ID string `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"` Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` Transports []string `json:"transports,omitempty" xml:"transports,omitempty" yaml:"transports,omitempty"` Success bool `json:"success,omitempty" xml:"success,omitempty" yaml:"success,omitempty"` AttestationObject *AttestationObject `json:"attestationObject,omitempty" xml:"attestationObject,omitempty" yaml:"attestationObject,omitempty"` ClientData *ClientData `json:"clientData,omitempty" xml:"clientData,omitempty" yaml:"clientData,omitempty"` Device *Device `json:"device,omitempty" xml:"device,omitempty" yaml:"device,omitempty"` }
WebAuthnRegisterRequest is Webauthn Register request.