Documentation
¶
Overview ¶
Package model holds the access module's entity values: users and groups, permissions, roles, projects and environments, access tokens, trusted and signing keys and the access policies, with the conversions between the account and permission values and JFrog's wire forms.
Role ¶
access module, core layer, entity values. The module's store ports take and return them, and the access services build on them. The access api publishes only the vocabulary other modules share (permission actions and resource types, key pairs and certificates, token shapes); everything else access persists is here (decision 0044, "Ownership of shared models"). The package imports the standard library, its own module's api (that vocabulary), the kernel (token values and scopes) and kernel/wire (JFrog's wire structs).
Inputs ¶
- For the conversions, JFrog's wire forms of users, groups and permissions, as kernel/wire declares them: the legacy security API's (permission targets v1 and v2) and Access's.
- For the checks and parsers, a project key, an environment name, a role action, a token subject or a user name.
Outputs ¶
- User, Group, UserStatus, MFAStatus, RoleFlags, RealmInternal and EffectiveAdmin; UserFromLegacy, UserToLegacy, UserFromAccess and UserToAccess, the same four for Group, and the sentinels ErrInvalidTimestamp and ErrInvalidStatus.
- Permission, Grants, Target, Resource and MatchesRepository; PermissionFromV1, PermissionToV1, PermissionFromV2, PermissionToV2, PermissionFromAccess and PermissionToAccess, and the sentinel ErrLossyProjection.
- Project, ProjectMember, RepositoryAssignment, AdminPrivileges, Role with RoleType, Environment and PrincipalType; ValidateProjectKey, ProjectRepoKey and the sentinel ErrInvalidProjectKey; and the role and environment vocabulary: GlobalRoleActions, IsGlobalRoleAction, MaxCustomGlobalRoles, BuiltinGlobalRoles, BuiltinGlobalRole, RoleActions, IsBuiltinEnvironment and ValidEnvironmentName.
- Token, Revocable, Subject and ParseSubject with the sentinel ErrInvalidSubject, the token defaults and TokenPurposeEncryptedPassword.
- TrustedKey and SigningKey.
- FoldUsername, SameUsername and FoldUsernames, the user name rule, and FoldUserGrants with Resource.FoldGrants and Permission.FoldGrants, its application to a permission's user grants.
- UserLockPolicy, PasswordExpirationPolicy, PasswordPolicy with DefaultPasswordPolicy, and AccessLockSettings with DefaultAccessLockSettings.
Invariants ¶
- A conversion to a wire form that cannot express a stored permission fails with ErrLossyProjection, rather than grant more or less than the permission does (decision 0006).
- Secrets held in memory (password hashes, token digests, a purposed token's secret, a signing key's private key and passphrase) are tagged json:"-", so no document column can hold one; the stores keep the sealed ones in sealed columns (decision 0017).
- A user name is stored and matched folded to lower case (FoldUsername), as Access treats user names: "User names are case-insensitive" (JFrog's SCIM page), and RTFACT-29660 (7.55.13) stores a user created "with capitalization" in lower case. A group name keeps its case (#1309).
- The string constants (statuses, role types, principal types, the built-in roles and environments) are stored and on the wire, so their values never change.
References ¶
- Decision 0005: docs/research/decisions/0005-authentication-and-tokens.md (tokens, their defaults and subjects).
- Decision 0006: docs/research/decisions/0006-authorization-native-permission-model.md (permissions and their wire forms).
- Decision 0013: docs/research/decisions/0013-projects-and-environments.md (projects, roles and environments).
- Decision 0017: docs/research/decisions/0017-sealed-columns-and-master-key.md (the sealed secrets).
- Decision 0020: docs/research/decisions/0020-domain-model.md (one internal value per entity, converted to and from the wire forms).
- Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md ("Ownership of shared models").
- Research 05: docs/research/05-platform-identity-and-security-apis.md. Research 07: docs/research/07-webhooks-retention-projects.md (projects and roles).
- Target layout: docs/research/architecture-options/5-modular-monolith.md, lines 272 to 276 (the access module's core/model and core/port), lines 577 and 578 (each module owns its store ports) and line 1058 (the shared types split into each module's core/model).
- Plan: docs/implementation/plan.md#p2-stores, task 0, #p4-identity-and-authorization and #p9d-modular-monolith-migration, epic STO (https://github.com/weaveplatform/artifactweave/issues/939).
- https://github.com/weaveplatform/artifactweave/issues/1054
Status ¶
Implemented P2: the access values among the shared domain types, with their wire conversions (pull request 3). P4 added the global roles and environments (pull request 93) and the encrypted-password token purpose (pull request 108), and AccessLockSettings came with the Access user lock policy endpoints (pull request 242). Moved here in P9d. The user name rule came with #1432.
Testing ¶
- permconv_test.go: the permission document, MatchesRepository, and the round trips through the v1, v2 and Access forms, with the defaults and the refusals of lossy projections.
- userconv_test.go: the user and group round trips through the legacy and Access forms, their defaults and status mapping, EffectiveAdmin and a user who never logged in.
- roles_test.go: the global role vocabulary, the built-in roles, environment names, RoleActions and the developer default.
- model_test.go: TestUnitToken (Expired, Revocable, the default expiry and ParseSubject), TestUnitProject (ValidateProjectKey and ProjectRepoKey) and TestUnitSigningKeyJSON (a signing key's secrets stay out of its JSON).
- username_test.go: TestUnitFoldUsername and TestUnitFoldGrants.
The module's contract suite, internal/access/adapters/storetest.Run, stores and reads these values in its identity, token, key and project subtests; the access adapters run it in memory and on SQLite, and the metadata store's contract in app/storetest runs it on its in-memory, SQLite and PostgreSQL stores.
Index ¶
- Constants
- Variables
- func EffectiveAdmin(u User, groups []Group) bool
- func FoldUserGrants(grants map[string]api.Actions) map[string]api.Actions
- func FoldUsername(name string) string
- func FoldUsernames(names []string) []string
- func GroupToAccess(g Group) wire.AccessGroup
- func GroupToLegacy(g Group) wire.LegacyGroup
- func IsBuiltinEnvironment(name string) bool
- func IsGlobalRoleAction(a string) bool
- func MatchesRepository(target, key, class string) bool
- func PermissionToAccess(p Permission) wire.AccessPermission
- func PermissionToV1(p Permission) (wire.PermissionTargetV1, error)
- func PermissionToV2(p Permission) (wire.PermissionTargetV2, error)
- func ProjectRepoKey(projectKey, name string) string
- func Revocable(expiresIn, threshold time.Duration, force, refreshable bool) bool
- func RoleActions(actions []string, resource api.ResourceType) api.Actions
- func SameUsername(a, b string) bool
- func UserToAccess(u User, effectiveAdmin bool) wire.AccessUser
- func UserToLegacy(u User) wire.LegacyUser
- func ValidEnvironmentName(name string) bool
- func ValidateProjectKey(key string) error
- type AccessLockSettings
- type AdminPrivileges
- type Environment
- type Grants
- type Group
- type MFAStatus
- type PasswordExpirationPolicy
- type PasswordPolicy
- type Permission
- type PrincipalType
- type Project
- type ProjectMember
- type RepositoryAssignment
- type Resource
- type Role
- type RoleFlags
- type RoleType
- type SigningKey
- type Subject
- type Target
- type Token
- type TrustedKey
- type User
- type UserLockPolicy
- type UserStatus
Constants ¶
const ( // DefaultTokenExpiry is token.default-expiry, the lifetime of an Access // token created without expires_in while no administrator has set one: // one year, as the Access configuration reference and the JFrog CLI give // it. JFrog's access-tokens page says 3600 s instead; decision 0005 // records the conflict, which the live check on #216 settles. DefaultTokenExpiry = 365 * 24 * time.Hour DefaultRevocableThreshold = 6 * time.Hour // LegacyTokenExpiry is the lifetime of a token the legacy // POST /api/security/token creates without expires_in. It is that // route's own default, not token.default-expiry, so raising the Access // default leaves the legacy route as it was (research 05 lists the 7.x // value as unconfirmed). LegacyTokenExpiry = time.Hour )
Token defaults from the Access configuration (research 05).
const MaxCustomGlobalRoles = 30
MaxCustomGlobalRoles is how many CUSTOM_GLOBAL roles JFrog allows.
const RealmInternal = "internal"
RealmInternal is the realm of users and groups artifactweave manages itself.
const TokenPurposeEncryptedPassword = "encrypted_password"
TokenPurposeEncryptedPassword marks the reference token that stands in for a user's encrypted password (GET /api/security/encryptedPassword). A user has at most one; it keeps its value, sealed, so it can be shown again, and it is revoked whenever the password is set or expired.
Variables ¶
var ErrInvalidProjectKey = errors.New("invalid project key")
ErrInvalidProjectKey reports a project key outside the documented pattern.
var ErrInvalidStatus = errors.New("invalid user status")
ErrInvalidStatus reports a user status no wire form defines.
var ErrInvalidSubject = errors.New("invalid token subject")
ErrInvalidSubject reports a token subject that is not an Access subject.
var ErrInvalidTimestamp = errors.New("invalid timestamp")
ErrInvalidTimestamp reports a timestamp a wire form could not have sent.
var ErrLossyProjection = errors.New("permission cannot be expressed in this wire form")
ErrLossyProjection reports a permission the requested legacy form cannot express. The legacy forms hold one include/exclude pattern pair per section, so a permission whose targets carry different patterns has no faithful legacy view; returning an error beats silently granting more or less than the stored permission.
var GlobalRoleActions = []string{
"READ_REPOSITORY", "ANNOTATE_REPOSITORY", "DEPLOY_CACHE_REPOSITORY",
"DELETE_OVERWRITE_REPOSITORY", "MANAGE_XRAY_MD_REPOSITORY",
"READ_RELEASE_BUNDLE", "ANNOTATE_RELEASE_BUNDLE", "CREATE_RELEASE_BUNDLE",
"DISTRIBUTE_RELEASE_BUNDLE", "DELETE_RELEASE_BUNDLE", "MANAGE_XRAY_MD_RELEASE_BUNDLE",
"READ_BUILD", "ANNOTATE_BUILD", "DEPLOY_BUILD", "DELETE_BUILD", "MANAGE_XRAY_MD_BUILD",
"READ_SOURCES_PIPELINE", "TRIGGER_PIPELINE", "READ_INTEGRATIONS_PIPELINE",
"READ_POOLS_PIPELINE",
"REPORTS_SECURITY", "WATCHES_SECURITY", "POLICIES_SECURITY", "RULES_SECURITY",
"READ_POLICIES_SECURITY",
}
GlobalRoleActions is the global role action vocabulary, in the order the Access API and the platform provider's validator list it (research 07). Only the repository and build actions grant anything in artifactweave; the rest are stored and echoed so roles round-trip.
Functions ¶
func EffectiveAdmin ¶
EffectiveAdmin reports whether u is an administrator directly or through a group with admin privileges; the Access user view reports it as effective_admin.
func FoldUserGrants ¶
FoldUserGrants returns grants keyed by folded user names. Two spellings of one name in a document, which no 7.x source describes, hold the union of their actions, so the result does not depend on map order.
func FoldUsername ¶
FoldUsername is the spelling a user name is stored and matched in: lower case, the access api's rule (api.FoldUsername), which gives its sources.
Every entry point folds a user name it is given before it reads or writes a store, and the stores compare names exactly, so they hold only lower-case names and any spelling of a name finds its user.
func FoldUsernames ¶
FoldUsernames returns names folded, in order; nil stays nil.
func GroupToAccess ¶
func GroupToAccess(g Group) wire.AccessGroup
GroupToAccess renders the Access v2 view.
func GroupToLegacy ¶
func GroupToLegacy(g Group) wire.LegacyGroup
GroupToLegacy renders the legacy view.
func IsBuiltinEnvironment ¶
IsBuiltinEnvironment reports whether name is DEV or PROD, compared without regard to case as environment names are.
func IsGlobalRoleAction ¶
IsGlobalRoleAction reports whether a is in GlobalRoleActions.
func MatchesRepository ¶
MatchesRepository reports whether target covers a repository of the given key and class (local, remote, virtual, federated, distribution).
func PermissionToAccess ¶
func PermissionToAccess(p Permission) wire.AccessPermission
PermissionToAccess renders the Access v2 form.
func PermissionToV1 ¶
func PermissionToV1(p Permission) (wire.PermissionTargetV1, error)
PermissionToV1 renders the legacy v1 view. Sections other than artifact are left out, as Artifactory's v1 API does; patterns must be uniform.
func PermissionToV2 ¶
func PermissionToV2(p Permission) (wire.PermissionTargetV2, error)
PermissionToV2 renders the legacy v2 view of the artifact, build and release bundle sections; other resource types have no legacy section.
func ProjectRepoKey ¶
ProjectRepoKey is the key a repository created inside a project gets.
func Revocable ¶
Revocable applies Access's rule: a token is revocable when it never expires, lives at least the revocable threshold, the caller forced it, or it is refreshable ("created with force_revocable: true or refreshable: true", revoketokenbyvalue). Other short-lived tokens are not tracked for revocation because they expire before a revocation list would matter; a refreshable one outlives its expiry through its refresh token.
func RoleActions ¶
func RoleActions(actions []string, resource api.ResourceType) api.Actions
RoleActions returns what a role's actions grant on one resource type. It is how the permission evaluator reads a role: pipeline, Release Bundle and security actions grant nothing here.
func SameUsername ¶
SameUsername reports whether a and b name the same user.
func UserToAccess ¶
func UserToAccess(u User, effectiveAdmin bool) wire.AccessUser
UserToAccess renders the Access v2 view. effectiveAdmin comes from EffectiveAdmin, which needs the user's groups.
func UserToLegacy ¶
func UserToLegacy(u User) wire.LegacyUser
UserToLegacy renders the legacy view. Role flags the legacy form does not know are dropped.
func ValidEnvironmentName ¶
ValidEnvironmentName reports whether name is 1 to 32 letters, digits, hyphens and underscores.
func ValidateProjectKey ¶
ValidateProjectKey checks the documented key rule: 2 to 32 characters, lower-case letters, digits and hyphens, starting with a letter. The key prefixes repository keys, so it is immutable once created.
Types ¶
type AccessLockSettings ¶
type AccessLockSettings struct {
SecondsToUnlock int `json:"seconds_to_unlock"`
AdminPasswordExpirable bool `json:"admin_password_expirable"`
MaxLoginDelayIncorrectAttempts int `json:"max_login_delay_incorrect_attempts"`
MaxLoginDelayMillis int64 `json:"max_login_delay_millis"`
BaseLoginDelayMillis int64 `json:"base_login_delay_millis"`
ClientLoginSuspensionEnabled bool `json:"client_login_suspension_enabled"`
}
AccessLockSettings are the Access user lock policy's fields beyond the lock limit (UserLockPolicy) and the password expiry (PasswordExpirationPolicy). The four login delay fields drive the temporary login suspension after failed Basic logins; SecondsToUnlock and AdminPasswordExpirable are stored and returned only, as the Access OpenAPI source says field by field.
func DefaultAccessLockSettings ¶
func DefaultAccessLockSettings() AccessLockSettings
DefaultAccessLockSettings is in force while none is stored: Access's server defaults. docs.jfrog.com, supported Access configurations (security.user-lock-policy), documents the two delays and seconds-to-unlock. The JFrog KB article on intermittent 403 errors gives the 2 failed attempts before a suspension. The getAccessUserLockPolicy reference page, the source of the suspension switch, is gone; the endpoint is now documented only in the migration notes of the deprecated JFrog APIs page.
type AdminPrivileges ¶
type AdminPrivileges struct {
ManageMembers bool `json:"manage_members,omitempty"`
ManageResources bool `json:"manage_resources,omitempty"`
IndexResources bool `json:"index_resources,omitempty"`
ManageRemoteRepository bool `json:"manage_remote_repository,omitempty"`
CreateRemoteRepository bool `json:"create_remote_repository,omitempty"`
DeleteRemoteRepository bool `json:"delete_remote_repository,omitempty"`
CreateLocalRepository bool `json:"create_local_repository,omitempty"`
DeleteLocalRepository bool `json:"delete_local_repository,omitempty"`
CreateVirtualRepository bool `json:"create_virtual_repository,omitempty"`
DeleteVirtualRepository bool `json:"delete_virtual_repository,omitempty"`
}
AdminPrivileges are the project admin switches, stored as one document.
type Environment ¶
Environment is a deployment stage repositories are assigned to. ProjectKey is empty for global environments.
type Grants ¶
type Grants struct {
Users map[string]api.Actions `json:"users,omitempty"`
Groups map[string]api.Actions `json:"groups,omitempty"`
}
Grants map principal names to the actions they hold.
type Group ¶
type Group struct {
Name string
Description string
AutoJoin bool
AdminPrivileges bool
Realm string
RealmAttributes string
ExternalID string
Members []string
Roles RoleFlags
}
Group is a set of users that permissions and roles can name.
func GroupFromAccess ¶
func GroupFromAccess(w wire.AccessGroup) Group
GroupFromAccess reads an Access v2 group document. The group form calls the resources role manage_resources; internally it is the same flag as the user form's resources_manager.
func GroupFromLegacy ¶
func GroupFromLegacy(w wire.LegacyGroup) Group
GroupFromLegacy reads a legacy group document.
type MFAStatus ¶
type MFAStatus string
MFAStatus is the legacy view's multi-factor status; artifactweave has no MFA of its own, so it reports what an identity provider recorded or NONE.
type PasswordExpirationPolicy ¶
type PasswordExpirationPolicy struct {
Enabled bool `json:"enabled"`
MaxAgeDays int `json:"max_age_days"`
NotifyByEmail bool `json:"notify_by_email"`
}
PasswordExpirationPolicy expires internal passwords after MaxAgeDays.
type PasswordPolicy ¶
type PasswordPolicy struct {
Uppercase int `json:"uppercase"`
Lowercase int `json:"lowercase"`
Digit int `json:"digit"`
SpecialChar int `json:"special_char"`
Length int `json:"length"`
NotMatchOld bool `json:"not_match_old"`
}
PasswordPolicy constrains new internal passwords.
DefaultPasswordPolicy is in force while none is stored, and a replacing PUT resets every field it leaves out to it.
func DefaultPasswordPolicy ¶
func DefaultPasswordPolicy() PasswordPolicy
DefaultPasswordPolicy is Access's documented default: no character classes required, at least 4 characters, and not the old password (docs.jfrog.com, supported Access configurations, security.password-policy). The documented rule that a password cannot match the username has no field and always applies.
type Permission ¶
type Permission struct {
Name string
Description string
Resources map[api.ResourceType]Resource
Created time.Time
Updated time.Time
}
Permission is the single internal representation of every permission wire form (decision 0006). Resources are stored as one JSON document in the Access v2 shape; the grants are also flattened into a table the authorizer queries by principal (research 15 section 4).
func PermissionFromAccess ¶
func PermissionFromAccess(w wire.AccessPermission) (Permission, error)
PermissionFromAccess reads an Access v2 permission. It is the internal shape already, so every resource type round-trips.
func PermissionFromV1 ¶
func PermissionFromV1(w wire.PermissionTargetV1) (Permission, error)
PermissionFromV1 reads a legacy v1 permission target. It covers repositories only, so the result has just the artifact resource.
func PermissionFromV2 ¶
func PermissionFromV2(w wire.PermissionTargetV2) (Permission, error)
PermissionFromV2 reads a legacy v2 permission target.
func (Permission) FoldGrants ¶
func (p Permission) FoldGrants() Permission
FoldGrants returns p with every section's user grants folded, leaving p's own sections untouched.
func (Permission) ResourceTypes ¶
func (p Permission) ResourceTypes() []api.ResourceType
ResourceTypes returns the permission's sections in a stable order.
type PrincipalType ¶
type PrincipalType string
PrincipalType distinguishes users from groups in memberships and grants.
const ( PrincipalUser PrincipalType = "user" PrincipalGroup PrincipalType = "group" )
Principal types.
type Project ¶
type Project struct {
Key string
DisplayName string
Description string
AdminPrivileges AdminPrivileges
StorageQuotaBytes int64 // -1 or 0 means unlimited, as the provider sends
SoftLimit bool
QuotaEmail bool
}
Project groups repositories, members and roles under a key.
type ProjectMember ¶
type ProjectMember struct {
ProjectKey string
Type PrincipalType
Name string
Roles []string
}
ProjectMember is a user or group's roles in one project.
type RepositoryAssignment ¶
type RepositoryAssignment struct {
RepoKey string
ProjectKey string
Environments []string
Updated time.Time
}
RepositoryAssignment records which project owns a repository and with whom it is shared.
type Resource ¶
Resource is one section of a permission: who may do what, where.
func (Resource) FoldGrants ¶
FoldGrants returns r with its user grants folded (FoldUserGrants); group grants keep their case.
type Role ¶
type Role struct {
ProjectKey string
Name string
Type RoleType
Description string
Environments []string
Actions []string
}
Role is a named set of actions over environments. ProjectKey is empty for global roles.
func BuiltinGlobalRole ¶
BuiltinGlobalRole returns the built-in global role called name.
func BuiltinGlobalRoles ¶
func BuiltinGlobalRoles() []Role
BuiltinGlobalRoles returns copies of the ADMIN and PREDEFINED global roles, in the order the Access API lists them.
type RoleFlags ¶
type RoleFlags struct {
WatchManager bool `json:"watch_manager,omitempty"`
PolicyViewer bool `json:"policy_viewer,omitempty"`
PolicyManager bool `json:"policy_manager,omitempty"`
ReportsManager bool `json:"reports_manager,omitempty"`
ResourcesManager bool `json:"resources_manager,omitempty"`
ManageWebhook bool `json:"manage_webhook,omitempty"`
PlatformAuditor bool `json:"platform_auditor,omitempty"`
}
RoleFlags are the platform role switches JFrog keeps on users and groups. They are stored as one JSON document per principal (research 15 section 4) because the set grows with JFrog releases and none of them is queried.
type RoleType ¶
type RoleType string
RoleType distinguishes built-in from administrator-defined roles.
type SigningKey ¶
type SigningKey struct {
Alias string
PublicKey string
PrivateKey string `json:"-"`
Passphrase string `json:"-"`
IsDefault bool
}
SigningKey signs bundle manifests. The private key and passphrase are sealed and never serialised.
type Subject ¶
Subject is a parsed Access token subject, jfac@<service id>/users/<name>.
func ParseSubject ¶
ParseSubject reads a token subject. The JFrog CLI extracts the user name from the "/users/" segment, so that form is the one artifactweave issues.
type Target ¶
type Target struct {
Include []string `json:"include_patterns"`
Exclude []string `json:"exclude_patterns"`
}
Target scopes a resource to paths inside one repository or special target.
type Token ¶
type Token struct {
ID string
Subject string
Scope kernel.Scope
Audience string
Description string
ProjectKey string
IssuedAt time.Time
ExpiresAt time.Time
Refreshable bool
Revocable bool
LastUsed time.Time
AccessDigest []byte `json:"-"`
RefreshDigest []byte `json:"-"`
ReferenceDigest []byte `json:"-"`
// Purpose marks a token with a special role; empty for an ordinary one.
// A subject has at most one token of each purpose.
Purpose string
// Secret is the reference token of a purposed token, kept so it can be
// shown again; stores seal it. Empty for an ordinary token.
Secret string `json:"-"`
// Identity is how the subject resolves to a user.
Identity kernel.TokenIdentity
// Registry is set on a registry token alone, which the Docker token
// endpoint issues and nothing stores (decision 0005): what it grants.
Registry *kernel.RegistryAccess `json:"-"`
// Parent is, on a registry token obtained with a token, the stored
// token it descends from; revoking that token revokes it.
Parent string `json:"-"`
}
Token is the stored record of an access token. The JWT itself is never stored: AccessDigest, RefreshDigest and ReferenceDigest are hashes used to revoke by value and to resolve refresh and reference tokens. A zero ExpiresAt means the token never expires.
type TrustedKey ¶
type TrustedKey struct {
Kid string
Alias string
PublicKey string
Fingerprint string
IssuedOn time.Time
IssuedBy string
ValidUntil time.Time
}
TrustedKey is a public GPG key trusted for verifying release bundles (/api/security/keys/trusted). Kid is server-assigned; the other derived fields are parsed from the key at upload.
type User ¶
type User struct {
Name string
Email string
PasswordHash []byte `json:"-"`
Admin bool
ProfileUpdatable bool
InternalPasswordDisabled bool
DisableUIAccess bool
Realm string
Status UserStatus
MFA MFAStatus
Groups []string
Roles RoleFlags
LastLoggedIn time.Time
Created time.Time
// FailedLogins counts consecutive failed password checks; the user lock
// policy locks the account when it reaches the limit, and a successful
// login or an unlock resets it.
FailedLogins int
// PasswordChanged is when the internal password was last set; the
// password expiration policy measures its age from here.
PasswordChanged time.Time
// PasswordExpired forces a password change: set by the expirePassword
// endpoint, cleared by unexpirePassword or a new password.
PasswordExpired bool
}
User is an account. PasswordHash is an Argon2id encoding (decision 0005) and never leaves the server; the wire forms carry passwords write-only.
func UserFromAccess ¶
func UserFromAccess(w wire.AccessUser) (User, error)
UserFromAccess reads an Access v2 user document.
func UserFromLegacy ¶
func UserFromLegacy(w wire.LegacyUser) (User, error)
UserFromLegacy reads a legacy user document. Absent flags take the documented defaults (profileUpdatable true, everything else false); the write-only password stays on the wire struct for the caller to hash.
type UserLockPolicy ¶
type UserLockPolicy struct {
Enabled bool `json:"enabled"`
LoginAttempts int `json:"login_attempts"`
}
UserLockPolicy locks an account after repeated failed logins.
type UserStatus ¶
type UserStatus string
UserStatus is the Access account status. The legacy API spells a subset of it in upper case.
const ( UserInvited UserStatus = "invited" UserEnabled UserStatus = "enabled" UserDisabled UserStatus = "disabled" UserLocked UserStatus = "locked" )
User statuses.