kernel

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package kernel holds the values every module shares: the store sentinel errors, keyset paging, deep copies of stored values, content checksums, the item path rules, token scopes, the token values every module reads, and the request principal with its context accessors, auth errors and credential references. It has no behaviour beyond parsing, paging and comparing scopes and carrying the principal, so a module, a platform package or the gateway can use it without depending on another module.

Role

kernel layer: the shared values below every module. It imports only the standard library and platform/httpkit/apierror, whose errors give the auth sentinels their HTTP status and message. It never imports a module, the gateway or app.

Inputs

None: the package holds values and functions that do no I/O.

Outputs

  • Sentinel errors that store adapters wrap and callers test with errors.Is: ErrNotFound, ErrConflict, ErrInvalidCursor and ErrInvalid; and ErrStore, which marks the store's own failure beside the driver's error rather than a verdict on the record.
  • Keyset paging: Page with Normalize and Key, DefaultLimit, MaxLimit, Cursor and Trim; PageFunc, a store list with its other arguments bound, and Pages, from NewPages, which walks its pages in order for a list written as it is read.
  • Clone, the deep copy a store hands out so that no caller shares stored state, and Normalise, the value every backend reads back.
  • Checksums, the hex digests of an item's content.
  • Item paths: SplitItemPath, RootPath and ErrInvalidItemPath.
  • Token scopes: Scope, a list of ScopeEntry values, with ScopeKind, ScopeActions and their constants. ParseScope reads a scope string of at most MaxScopeLength characters and refuses any other with ErrInvalidScope; UserScope is an identity token's default scope. String renders the canonical form, IsAdmin and Narrows compare scopes, and ScopeActions.Covers compares actions.
  • Token values: TokenIdentity, with IdentityStored, IdentityTransient and IdentitySynthetic, says how a token's subject resolves to a user; RegistryAccess, a list of RegistryGrant values, is what a registry token grants.
  • The request principal: Principal, who a request acts as, with AnonymousUser and Anonymous, the principal of a request without credentials. WithPrincipal stores a principal in a context and FromContext reads it back; PrincipalBinding identifies the call that stored it, which access binds the request's permission decider to. RequireAuthenticated and RequireAdmin refuse a request without a user or without an administrator.
  • The auth sentinels, API errors with an HTTP status: ErrBadCredentials and ErrUnauthenticated (401), and ErrForbidden, ErrAPIRestricted, ErrPasswordExpired and ErrAccountLocked (403).
  • Credential references: CredentialReference, with RegistryReference for a registry token's caller, is what queued work keeps of the principal that scheduled it, and DownloadCredential is what a signed download envelope keeps. Principal.CredentialReference, CredentialReference.Principal and Principal.DownloadReference convert between them.

Invariants

  • Error texts are observable in API responses and logs, so they stay byte-identical: "store: not found", "store: conflict", "store: invalid cursor", "store: invalid record", "invalid item path" and "invalid token scope".
  • Sentinels are compared by identity through errors.Is.
  • RootPath is "." because AQL reports root items that way and the item table stores them the same way, so a root listing and a nested listing are one query (decision 0004).
  • Scopes only narrow (decision 0005): a token issued from another token, or by a user who is not an administrator, must narrow the scope it comes from, and Narrows is that check.
  • String renders any scope that ParseScope accepted to a string that ParseScope reads back as the same scope. Token records store a scope as that string and a token's scp claim carries it, so a scope that did not survive the trip would change what a stored or issued token grants.
  • Token records store TokenIdentity values and a registry token's idn claim carries them; the registry claim carries RegistryAccess as JSON; and the credential reference that queued work keeps for a registry token's caller holds both. The values and JSON names therefore stay as they are, and TestUnitCredentialReferenceGolden pins the JSON.
  • Credential-reference JSON is persisted in work items (decision 0033) and hashed into replay scopes (decision 0043), and signed download envelopes carry a DownloadCredential, so the fields and JSON tags of CredentialReference, RegistryReference and DownloadCredential never change; TestUnitCredentialReferenceGolden pins the bytes.
  • The auth sentinels' messages are what JFrog clients print, and their 401 and 403 split is Artifactory's (decision 0005), so statuses and texts stay byte-identical: 401 "Bad Credentials" and "Authentication is required"; 403 "Forbidden", "API access is temporarily restricted", "Password has expired" and "Login has failed. Due to Incorrect username/password or locked user.".
  • The principal carries no permission evaluator (decision 0006): access evaluates a request's permissions once and binds the evaluator to the WithPrincipal call, through PrincipalBinding, so an evaluator never answers for a principal that another call stored.
  • Only access and the kernel read or set PasswordRevision, IsTokenAuthenticated and TokenSubject, which access trusts when it rechecks a credential; TestUnitPrincipalInternals in internal/layout enforces it.

References

  • Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md, "Persistence" (what the kernel holds and imports), "Composition and HTTP" (the per-request decider bound through PrincipalBinding) and "Names the migration introduces".
  • Target layout: docs/research/architecture-options/5-modular-monolith.md, "Full package tree", lines 118 to 125, and "Summary", dependency rule 4 (lines 40 to 41).
  • Decision 0004: docs/research/decisions/0004-storage-sql-metadata-and-blobs.md.
  • Decision 0005: docs/research/decisions/0005-authentication-and-tokens.md: scopes only narrow, the transient and synthetic token identities, the registry token defaults, and the 401 and 403 split with the messages JFrog clients print.
  • Decision 0006: docs/research/decisions/0006-authorization-native-permission-model.md: permissions are evaluated once per request, in access, so the principal carries no evaluator.
  • Decision 0015: docs/research/decisions/0015-testing-and-acceptance.md (fuzz seed corpora in the three-OS Go test matrix).
  • Decision 0020: docs/research/decisions/0020-domain-model.md.
  • Decision 0031: docs/research/decisions/0031-docker-oci-registry.md, "Authentication on the registry": on the registry, the effective actions are those the token grants, intersected with the caller's current permissions.
  • Decision 0033: docs/research/decisions/0033-persistent-work-queue.md: work items hold an internal credential reference, never a password or bearer token.
  • Decision 0043: docs/research/decisions/0043-api-reliability.md: the replay scope is a SHA-256 digest of the credential reference, "Temporary restrictions and administrative recovery", and "Streaming complete lists", which Pages serves.
  • https://github.com/weaveplatform/artifactweave/issues/1409 (Pages).
  • Research 05: docs/research/05-platform-identity-and-security-apis.md, "Scope grammar".
  • Plan: docs/implementation/plan.md#p9d-modular-monolith-migration, epic PLT (https://github.com/weaveplatform/artifactweave/issues/938).
  • https://github.com/weaveplatform/artifactweave/issues/961
  • https://github.com/weaveplatform/artifactweave/issues/962
  • https://github.com/weaveplatform/artifactweave/issues/965

Status

Implemented P2 to P9: the store values, paging and item paths in P2, with the SHA-512 checksum added in P7; token scopes with the P0 to P2 baseline, with build scopes added in P5; the request principal and its 401 and 403 errors in P3; token identities and the password expiry and account lock errors in P4; registry grants in P6; the credential references in P9. The API restriction error came with decision 0043. Moved here in P9d.

Testing

  • TestUnitPage, TestUnitTrim: limits, cursor decoding and the cursor of the next page.
  • TestUnitPages: a walk passes each page's cursor to the next read, stops after the last page, and stays where it was when a read fails.
  • TestUnitCloneAndNormalise: copies share no memory with their input, and normalised times and durations have the precision of the SQL columns.
  • TestUnitSplitItemPath: the canonical parent, name and depth, and the segments that are refused.
  • TestUnitParseScope, TestUnitParseScopeErrors: the scope grammar, its canonical form and the strings it refuses.
  • TestUnitScopeHelpers, TestUnitScopeNarrows: UserScope, IsAdmin, ScopeActions.Covers and the narrowing rule.
  • FuzzParseScope, with its seed corpus in testdata/fuzz/FuzzParseScope: whatever ParseScope accepts renders, within MaxScopeLength, to a canonical string that parses back to the same scope and narrows itself. make test runs the seeds (FUZZ_PKGS) and CI runs them in the three-OS Go test matrix; go test -fuzz=FuzzParseScope explores further.
  • TestUnitPrincipalContext: WithPrincipal and FromContext, a binding per WithPrincipal call that derived contexts keep, and the 401 and 403 split of RequireAuthenticated and RequireAdmin.
  • TestUnitCredentialReferenceGolden, with testdata/credential_reference.golden.json: the JSON of every kind of credential reference and download credential, byte for byte, and a reference that goes through Principal and back unchanged. Rewrite the golden file with -update only for a deliberate format change.

Index

Constants

View Source
const (
	DefaultLimit = 100
	MaxLimit     = 1000
)

Page bounds.

View Source
const AnonymousUser = "anonymous"

AnonymousUser is the name of the built-in anonymous user.

View Source
const MaxScopeLength = 500

MaxScopeLength is the longest scope string Access accepts on token create.

View Source
const RootPath = "."

RootPath is the parent path of an item that sits at the repository root. AQL reports it as "." and the item table stores it the same way, so a root listing and a nested listing are the same query (decision 0004).

Variables

View Source
var (
	// ErrBadCredentials answers credentials that do not verify. The capital
	// C is 7.x's from 7.117 on: with the internal realm on in Access, as its
	// shipped config sets it, a refused password ends in
	// AccessAuthProviderUtils' BadCredentialsException("Bad Credentials")
	// (7.117.5 to 7.161.26; "Bad credentials" up to 7.111.22, and still in
	// Spring's DaoAuthenticationProvider, which 7.x skips while Access
	// handles the realm). RTFACT-31253 captures it on 7.117.12 (#1486).
	ErrBadCredentials = apierror.New(http.StatusUnauthorized, "Bad Credentials")
	// ErrUnauthenticated answers a request that needs a user and has none.
	ErrUnauthenticated = apierror.New(http.StatusUnauthorized, "Authentication is required")
	// ErrForbidden answers an authenticated user without the right.
	ErrForbidden = apierror.New(http.StatusForbidden, "Forbidden")
)

The messages JFrog clients print. No public source documents Artifactory's exact wording; jfrog-client-go shows errors[].message as it comes.

View Source
var (
	// ErrNotFound reports that a keyed record does not exist.
	ErrNotFound = errors.New("store: not found")
	// ErrConflict reports a create that collides with an existing key, or a
	// change that would break a uniqueness rule.
	ErrConflict = errors.New("store: conflict")
	// ErrInvalidCursor reports a malformed pagination cursor.
	ErrInvalidCursor = errors.New("store: invalid cursor")
	// ErrInvalid reports a record the store cannot hold as given, for
	// example an item path that does not split into parent and name.
	ErrInvalid = errors.New("store: invalid record")
	// ErrStore marks a failure of the store itself, a statement the
	// database failed to run, beside the driver's own error, so a caller
	// can tell it from a verdict on the record (ErrNotFound, ErrConflict,
	// ErrInvalid) and from a refusal by its own code. Its text is never
	// shown: an error that carries it reads as the driver's.
	ErrStore = errors.New("store: failure")
)

Sentinel errors. Implementations wrap them; callers test with errors.Is.

View Source
var Anonymous = Principal{Name: AnonymousUser, Anonymous: true}

Anonymous is the principal of a request without credentials when anonymous access is on.

View Source
var ErrAPIRestricted = apierror.New(http.StatusForbidden, "API access is temporarily restricted")

ErrAPIRestricted answers a user whose API access an administrator has temporarily restricted (decision 0043). It is returned only after the credential has been verified.

View Source
var ErrAccountLocked = apierror.New(http.StatusForbidden,
	"Login has failed. Due to Incorrect username/password or locked user.")

ErrAccountLocked answers any password for a locked account. 403, as Artifactory's entry point answers a LockedException, with the message of 7.161.26's UserLockedException.userLocked, which AccessFilter's lock check throws before any password is read. The text names a wrong password as well as the lock "to avoid any clue for the hacker to identify valid user accounts" (RTFACT-24156, 7.11), so it replaces OSS 6.20's "User is Locked." (decision 0005). It differs from the 403 of access's temporary login suspension, which ends by itself, where this lasts until an administrator unlocks the account.

View Source
var ErrInvalidItemPath = errors.New("invalid item path")

ErrInvalidItemPath reports a repository path that cannot name an item.

View Source
var ErrInvalidScope = errors.New("invalid token scope")

ErrInvalidScope reports a token scope string the grammar does not accept.

View Source
var ErrPasswordExpired = apierror.New(http.StatusForbidden, "Password has expired")

ErrPasswordExpired answers a correct password the expiration policy, or an administrator, has expired. It is reported only after the password verifies, so it tells nothing to someone without it. 403 rather than 401, with Artifactory's message: its entry point answers a CredentialsExpiredException as it does a locked account (decision 0005).

Functions

func Clone

func Clone[V any](v V) V

Clone deep-copies v: maps, slices and pointers are duplicated, nil stays nil and empty stays empty, so a caller can neither see nor make later changes to stored state.

func Cursor

func Cursor(parts ...string) string

Cursor returns the opaque cursor that continues a list after the record whose sort key is parts. Implementations call it for the last record of a page; callers treat the result as opaque.

func Normalise

func Normalise[V any](v V) V

Normalise is Clone with times truncated to UTC microseconds and durations to milliseconds, the precision of the SQL columns: what every backend returns for a value it was given. Contract tests build their expectations with it.

func PrincipalBinding

func PrincipalBinding(ctx context.Context) any

PrincipalBinding identifies the WithPrincipal call that set ctx's principal (nil when none). Access binds the request's evaluator to it. Bindings compare with ==: two calls never share one, and a context derived from ctx other than by WithPrincipal keeps ctx's.

func SplitItemPath

func SplitItemPath(full string) (parent, name string, depth int, err error)

SplitItemPath turns a repository-relative path into the canonical parent, name and depth. Leading and trailing slashes are ignored, so folder paths from deploys ("a/b/") and storage paths ("/a/b") both work; empty, "." and ".." segments are refused because they would let a path escape or alias another item.

func Trim

func Trim[T any](rows []T, limit int, key func(T) []string) ([]T, string)

Trim cuts rows, fetched with one more row than limit, to the page and returns the cursor of the next page ("" when rows was the last page). key returns a record's sort key, the parts Page.Key decodes.

func WithPrincipal

func WithPrincipal(ctx context.Context, p Principal) context.Context

WithPrincipal returns ctx carrying p. Each call stores a new binding (see PrincipalBinding), so a permission decider that access bound to an earlier call never answers for p; access stores a principal it has authorised together with that principal's decider instead.

Types

type Checksums

type Checksums struct {
	SHA256 string `json:"sha256,omitempty"`
	SHA512 string `json:"sha512,omitempty"`
	SHA1   string `json:"sha1,omitempty"`
	MD5    string `json:"md5,omitempty"`
}

Checksums are hex digests of an item's content.

type CredentialReference

type CredentialReference struct {
	Registry         *RegistryReference `json:"registry,omitempty"`
	Name             string             `json:"name"`
	TokenID          string             `json:"tokenid"`
	Anonymous        bool               `json:"anonymous"`
	Password         bool               `json:"password"`
	PasswordRevision [32]byte           `json:"passwordrevision"`
}

CredentialReference records which already-authenticated identity scheduled bounded background work. It carries no credential or group membership. A registry reference retains its original narrowing grant for access's CurrentRegistry; it must never become an ordinary HTTP credential. The password revision is an opaque fence; it cannot authenticate a new request. References are internal persisted data and must never be accepted from clients.

func (CredentialReference) Principal

func (r CredentialReference) Principal() Principal

Principal returns the principal r names. It must pass access's Authenticator.Current (CurrentRegistry for registry references) and Authorize before use. It restores no cached admin status; the retained registry scope can only narrow current permissions.

type DownloadCredential

type DownloadCredential struct {
	Kind             string   `json:"kind"`
	TokenID          string   `json:"token_id,omitempty"`
	PasswordRevision [32]byte `json:"password_revision,omitzero"`
}

DownloadCredential is a credential reference for an authenticated, signed download envelope. It contains no password or bearer token. Possession of this reference is not authentication: callers must verify their envelope's signature, subject, path, digest and expiry before access's RestoreDownload is called.

type Page

type Page struct {
	After string
	Limit int
}

Page selects one page of a list. After is the next value returned with the previous page ("" for the first page). Limit bounds the page: DefaultLimit when zero or negative, capped at MaxLimit.

func (Page) Key

func (p Page) Key(n int) ([]string, error)

Key decodes After into the n parts of the sort key it continues after. It returns nil for the first page and ErrInvalidCursor when After does not carry exactly n parts, which is what a cursor from a different list looks like.

func (Page) Normalize

func (p Page) Normalize() (Page, error)

Normalize applies the default and maximum limit and checks that After decodes.

type PageFunc

type PageFunc[T any] func(ctx context.Context, p Page) ([]T, string, error)

PageFunc reads one keyset page of a list: at most p.Limit rows after p.After, in the list's order, and the cursor of the next page, "" after the last. Every store List method with a Page has this shape once its other arguments are bound.

type Pages

type Pages[T any] struct {
	// contains filtered or unexported fields
}

Pages walks a PageFunc's pages in order, so that a caller writing a list as it reads it holds one page and never the whole list (decision 0043, "Streaming complete lists"). The rows come in exactly the order the PageFunc gives, the order a caller that collects every page sees. Build one with NewPages; it is not safe for concurrent use.

func NewPages

func NewPages[T any](read PageFunc[T], limit int) *Pages[T]

NewPages starts a walk of read's list with pages of limit rows, under Page's default and cap.

func (*Pages[T]) Next

func (p *Pages[T]) Next(ctx context.Context) ([]T, bool, error)

Next reads the next page. It reports false, with no rows, once the list has ended. A failed read leaves the walk where it was.

type Principal

type Principal struct {
	Name      string
	Admin     bool
	Anonymous bool
	Groups    []string
	// Scope is the scope of the access token the request presented; empty
	// for a password or anonymous request, which act with the user's full
	// permissions. Scopes only narrow (decision 0005); the permission
	// evaluator applies them.
	Scope Scope
	// TokenID is the id of the access or reference token the request
	// presented; empty for a password or anonymous request. The token API's
	// "me" resolves to it, and encryptedPassword refuses token callers.
	TokenID string
	// TokenExpires is when that token expires; zero for a password, an
	// anonymous request or a token that never expires. A registry token
	// obtained with a token lives no longer (decision 0005).
	TokenExpires time.Time
	// Registry is what a registry token grants, nil for any other
	// credential. Such a principal reaches the registry's routes alone.
	Registry *RegistryAccess
	// Identity is how the token's subject resolved to a user: transient or
	// synthetic for a token from an OIDC exchange, transient for one an
	// administrator minted for a name that is no stored user; a registry
	// token obtained with it keeps it (decision 0005).
	Identity TokenIdentity
	// TokenParent is, for a registry token, the stored token it descends
	// from: a registry token it obtains descends from the same one.
	TokenParent string
	// PasswordExpired marks a principal whose correct password has expired.
	// The middleware lets it through only to change its own password.
	PasswordExpired bool
	// Password marks a principal that a user name and password
	// authenticated, which the Access token API refuses while
	// token.allow_basic_auth is off (#385). An empty TokenID cannot stand
	// for it: anonymous and hand-built principals have none either.
	Password bool
	// PasswordRevision fences a long request against a password change
	// without retaining the credential itself: the SHA-256 digest of the
	// stored password hash that the request's password, or the user of its
	// registry token, matched; zero for any other credential. Only access
	// and the kernel read or set it.
	PasswordRevision [32]byte
	// IsTokenAuthenticated marks a principal authenticated by an access
	// token, whose Scope applies even when it is empty. Only access and the
	// kernel read or set it.
	IsTokenAuthenticated bool
	// TokenSubject retains the verified subject for registry-token
	// revalidation, which checks it against the parent token and resolves it
	// to the user again. Only access and the kernel read or set it.
	TokenSubject string
}

Principal is who a request acts as. It holds no permissions: access's Authorizer returns the decider that answers for it, and access/api's WithCaller carries the two together in a request's context.

PasswordRevision, IsTokenAuthenticated and TokenSubject are exported only because access, which sets them when it verifies a credential, is another package. Access trusts them when it rechecks that credential for a long request or for queued work, so a value set anywhere else could pass the recheck for a credential that was never verified. TestUnitPrincipalInternals (internal/layout) fails on any use outside access and the kernel.

func FromContext

func FromContext(ctx context.Context) (Principal, bool)

FromContext returns the request's principal; ok is false when the request is unauthenticated (no credentials and anonymous access off).

func RequireAdmin

func RequireAdmin(ctx context.Context) (Principal, error)

RequireAdmin returns ErrUnauthenticated without a user and ErrForbidden for a user who is not an administrator, the split Artifactory makes between 401 and 403.

func RequireAuthenticated

func RequireAuthenticated(ctx context.Context) (Principal, error)

RequireAuthenticated returns ErrUnauthenticated unless the request carries a user other than anonymous.

func (Principal) CredentialReference

func (p Principal) CredentialReference() CredentialReference

CredentialReference returns the reference that background work keeps in place of p's credential: p's name, token ID, anonymous and password flags and password revision, and for a registry token what RegistryReference keeps, with a copy of its grant. It leaves out p's admin flag and groups, which access evaluates again when the work runs.

func (Principal) DownloadReference

func (p Principal) DownloadReference() (DownloadCredential, error)

DownloadReference retains only the identity needed to revalidate the original credential. The stored token remains authoritative for identity, scope and expiry. It returns ErrBadCredentials for a registry token, an expired password, a principal without a name, and a principal that no token, password or anonymous access authenticated.

type RegistryAccess

type RegistryAccess struct {
	// Realm is the repository key the token endpoint was addressed by, the
	// <repo> of .../api/docker/<repo>/v2/token or a subdomain's repository;
	// empty for null and for /v2/token on the repository path, where each
	// name begins with its repository key.
	Realm  string          `json:"realm,omitempty"`
	Grants []RegistryGrant `json:"access"`
}

RegistryAccess is what a registry token grants: the scopes the client asked the token endpoint for, each with only the actions the caller held.

type RegistryGrant

type RegistryGrant struct {
	Type    string   `json:"type"`
	Name    string   `json:"name"`
	Actions []string `json:"actions"`
}

RegistryGrant is one granted scope in the Docker token specification's form: type repository with an image name as the client addresses it and the actions pull, push and delete, or type registry with name catalog.

type RegistryReference

type RegistryReference struct {
	Verified bool           `json:"verified"`
	Access   RegistryAccess `json:"access"`
	Scope    string         `json:"scope"`
	Subject  string         `json:"subject"`
	Expires  time.Time      `json:"expires"`
	Parent   string         `json:"parent"`
	Identity TokenIdentity  `json:"identity"`
}

RegistryReference is what a CredentialReference keeps of a registry token's caller: whether the token verified, what it grants, its scope in canonical form, and its subject, expiry, parent token and identity. Access's CurrentRegistry rechecks them against current state, which can only remove access.

type Scope

type Scope struct {
	Entries []ScopeEntry
}

Scope is a parsed token scope.

func ParseScope

func ParseScope(s string) (Scope, error)

ParseScope reads a scope string. Entries are separated by whitespace outside double quotes, because group and role names may be quoted and may contain spaces ("Project Admin").

func UserScope

func UserScope() Scope

UserScope is the default scope of an identity token.

func (Scope) IsAdmin

func (s Scope) IsAdmin() bool

IsAdmin reports whether the scope applies administrator permissions.

func (Scope) Narrows

func (s Scope) Narrows(parent Scope) bool

Narrows reports whether s grants nothing beyond parent, which is the rule for issuing a token from another token or for a non-admin creating one: scopes only narrow (decision 0005). Resource scopes (artifact, build, repo, project) intersect the subject's applied permissions, so any applied entry covers them; system scopes grant capabilities the subject's permissions do not, so only admin or a matching system scope covers them.

func (Scope) String

func (s Scope) String() string

String renders the scope in canonical form, entries separated by a space.

type ScopeActions

type ScopeActions uint16

ScopeActions are the resource-scope action letters r w d a x s m, or all.

const (
	ScopeRead ScopeActions = 1 << iota
	ScopeWrite
	ScopeDelete
	ScopeAnnotate
	ScopeExecute
	ScopeScan
	ScopeManage
	ScopeAll
)

Scope actions. ScopeAll is "*".

func (ScopeActions) Covers

func (a ScopeActions) Covers(b ScopeActions) bool

Covers reports whether a grants everything b does.

func (ScopeActions) String

func (a ScopeActions) String() string

type ScopeEntry

type ScopeEntry struct {
	Kind      ScopeKind
	Names     []string
	Project   string
	Target    string
	Path      string
	Qualifier string
	Actions   ScopeActions
}

ScopeEntry is one space-separated element of a scope string. Which fields are set depends on Kind: Names for groups and roles, Project for roles and project scopes, Target for the repository (artifact, build, repo), the project area or the system area, Path for an artifact or build ant path (a build's path is its document's, <name>/<number>-<started>.json), Qualifier for the part of a system scope after '@'.

func (ScopeEntry) String

func (e ScopeEntry) String() string

String renders the entry in canonical form: names quoted only when they need it, actions in r,w,d,a,x,s,m order.

type ScopeKind

type ScopeKind int

ScopeKind is the kind of one scope entry (research 05, scope grammar).

const (
	ScopeUser     ScopeKind = iota + 1 // applied-permissions/user
	ScopeAdmin                         // applied-permissions/admin
	ScopeGroups                        // applied-permissions/groups:"a","b"
	ScopeRoles                         // applied-permissions/roles:<project>:<role>,...
	ScopeArtifact                      // artifact:<repo|*>[/<ant path>]:<actions>
	ScopeRepo                          // repo:<key>:<actions>
	ScopeProject                       // project:<key>/<area>:<actions>
	ScopeSystem                        // system:<area>[@<qualifier>]:<actions>
	ScopeBuild                         // build:<build-info repo|*>[/<ant path>]:<actions>
)

Scope kinds.

type TokenIdentity

type TokenIdentity string

TokenIdentity says how a token's subject resolves to a user. Access issues tokens from an OIDC token exchange without checking that the mapped user exists (research 21), so such a token may name a user who is not stored.

const (
	// IdentityStored: the subject must be a stored, enabled user. Every
	// token whose subject was a stored user when it was issued, other than
	// an OIDC exchange's.
	IdentityStored TokenIdentity = ""
	// IdentityTransient: a stored user of that name if there is one;
	// otherwise a transient user for the request, a member of the groups new
	// users join automatically. An OIDC exchange issues it, and so does an
	// administrator minting a token for a name that is no stored user.
	IdentityTransient TokenIdentity = "transient"
	// IdentitySynthetic: never a stored user and in no group but those the
	// scope names. An identity mapping without a user name issues it, so a
	// group-scoped token acts through exactly its groups.
	IdentitySynthetic TokenIdentity = "synthetic"
)

Token identities.

Directories

Path Synopsis
Package antpath matches paths against Ant-style patterns, the form Artifactory uses for permission target and repository include and exclude patterns, token scope paths, the pattern search and remote repositories' external dependency patterns: '/' separates segments, "**" matches any number of segments, '*' any run of characters within one segment and '?' exactly one character.
Package antpath matches paths against Ant-style patterns, the form Artifactory uses for permission target and repository include and exclude patterns, token scope paths, the pattern search and remote repositories' external dependency patterns: '/' separates segments, "**" matches any number of segments, '*' any run of characters within one segment and '?' exactly one character.
Package wire holds the JFrog JSON forms that artifactweave exchanges field for field: the legacy v1 and v2 permission targets, the Access v2 permission, the legacy and Access user and group documents, the proxy descriptor, the Smart Remote statistics submission, the JFrog CLI's multipart upload status and the blob mirror additions to the storage summary.
Package wire holds the JFrog JSON forms that artifactweave exchanges field for field: the legacy v1 and v2 permission targets, the Access v2 permission, the legacy and Access user and group documents, the proxy descriptor, the Smart Remote statistics submission, the JFrog CLI's multipart upload status and the blob mirror additions to the storage summary.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL