Documentation
¶
Overview ¶
Package accesshttp is the access module's HTTP adapter: the authentication middleware, the access spec's server and the artifactory spec's security partial, with every access handler, the API restriction middleware and the access contributions to the router's request handling.
Role ¶
access module, HTTP adapter layer. The composition root mounts what this package exports; nothing else in the module serves HTTP. It reaches the artifacts module only through artifacts/api, and it imports no server or router package: the router hands it what it needs from other modules as options and functions.
Inputs ¶
- Driving: the router, which installs Authenticate with AuthnOptions, PlusAsSpace, APIRecoveryContext and Server.CheckAPIRestriction, mounts Server.RegisterRoutes, and embeds Server.Access and Server.Security in the generated strict servers beside the generated stubs.
- Deps, from the composition root: the access API, the Store (the access ports, the settings and the configuration documents), the authenticator, the token service, the OIDC verifier, the settings, the password cost, the compatibility version, the logger and the artifacts module's Repositories, through which the handlers read every repository.
- From the router, as functions: the health predicate and limit error writer of CheckAPIRestriction, and the skips, registry predicates and credential keepers of AuthnOptions.
Outputs ¶
- Authenticate and AuthnOptions: the request's principal and its decider on the context (kernel.Principal, authn.WithAuthorized).
- Server, built by New over Deps: AccessService and SecurityAPI, the partial strict servers, and RegisterRoutes for the legacy token routes.
- The router's contributions: PublicRoutes, SlashCollections, DetailRules with RequestDetails, PlusAsSpace, APIRecoveryRequest, APIRecoveryContext and Server.CheckAPIRestriction.
Invariants ¶
- Authenticate decides in the order its comment lists (decision 0005): self-authenticated routes and skips, then credentials, which answer 401 at once when they do not verify, then anonymous access, and only then the public routes. An API key (X-JFrog-Art-Api, or X-Api-Key after a blank one) is read first and alone, whatever the Authorization header says, as 7.x's props filter reads it. A refused key that is not blank answers 403, as does a NuGet client's refused password, a locked account, an expired password and a suspended login, each with the Basic challenge, as 7.x's entry point answers them; the entry point's answers to its UI's requests carry no challenge. An Authorization value 7.x reads no credential from, such as "Basic Og==", "Bearer" without a token or another scheme, counts as no credential at all, as do a blank X-JFrog-Art-Api and Basic credentials naming the anonymous user while anonymous access is off.
- Every principal it lets through is authorised once, and handlers ask that decider (decision 0006).
- A key pair delete clears the repositories' references to the pair and deletes it in one store transaction: a failure at any step leaves both as they were.
- Statuses, envelopes and error and log text are what JFrog's clients and the operators' logs read, so they stay byte-identical.
- accessState, which both partials embed, defines no method named after an operation, so the composite's depth-2 stubs never collide with it.
References ¶
- Decision 0005: docs/research/decisions/0005-authentication-and-tokens.md (credential forms, the expired token refresh, the compatibility version).
- Decision 0006: docs/research/decisions/0006-authorization-native-permission-model.md (the once-per-request decider and the permission APIs).
- Decision 0043: docs/research/decisions/0043-api-reliability.md (API restrictions and the recovery requests, bounded as before).
- Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md ("Dependency rules": a module reaches another only through its api).
- Target layout: docs/research/architecture-options/5-modular-monolith.md, lines 290 to 295 and 553 (the access module's HTTP adapter), and the mapping at lines 395 and 396.
- https://github.com/weaveplatform/artifactweave/issues/1072
Status ¶
Implemented P4 as the server root's access handlers: the legacy security and Access APIs, permissions, tokens and the OIDC exchange; API restrictions came with retry safety and bounded API execution (pull request 905). P9d split them into partial strict servers (WEB-07) and moved them here (WEB-09) and narrowed Deps.Store to the adapter's own Store (ACC-14).
Testing ¶
The unit tests here call the middleware and the partials directly over in-memory stores, without the router; TestUnitDeleteKeyPairIsOneTransaction checks the key pair transaction. The route suites under test/server/access and the router's guards in app (its status, principal and ledger tables) reach the handlers through the router.
Index ¶
- func APIRecoveryContext(next http.Handler) http.Handler
- func APIRecoveryRequest(r *http.Request) bool
- func Authenticate(o AuthnOptions) func(http.Handler) http.Handler
- func PlusAsSpace(next http.Handler) http.Handler
- func PublicRoutes() map[string]bool
- func SlashCollections() map[string]string
- type AccessService
- func (s AccessService) ChangeUserPassword(ctx context.Context, req accessgen.ChangeUserPasswordRequestObject) (accessgen.ChangeUserPasswordResponseObject, error)
- func (s AccessService) ConfigureAccessUserLockPolicy(ctx context.Context, req accessgen.ConfigureAccessUserLockPolicyRequestObject) (accessgen.ConfigureAccessUserLockPolicyResponseObject, error)
- func (s AccessService) CreateGlobalEnvironment(ctx context.Context, req accessgen.CreateGlobalEnvironmentRequestObject) (accessgen.CreateGlobalEnvironmentResponseObject, error)
- func (s AccessService) CreateGlobalRole(ctx context.Context, req accessgen.CreateGlobalRoleRequestObject) (accessgen.CreateGlobalRoleResponseObject, error)
- func (s AccessService) CreateGroup(ctx context.Context, req accessgen.CreateGroupRequestObject) (accessgen.CreateGroupResponseObject, error)
- func (s AccessService) CreateOidcConfiguration(ctx context.Context, req accessgen.CreateOidcConfigurationRequestObject) (accessgen.CreateOidcConfigurationResponseObject, error)
- func (s AccessService) CreateOidcIdentityMapping(ctx context.Context, req accessgen.CreateOidcIdentityMappingRequestObject) (accessgen.CreateOidcIdentityMappingResponseObject, error)
- func (s AccessService) CreatePasswordPolicy(ctx context.Context, req accessgen.CreatePasswordPolicyRequestObject) (accessgen.CreatePasswordPolicyResponseObject, error)
- func (s AccessService) CreatePermission(ctx context.Context, req accessgen.CreatePermissionRequestObject) (accessgen.CreatePermissionResponseObject, error)
- func (s AccessService) CreateToken(ctx context.Context, req accessgen.CreateTokenRequestObject) (accessgen.CreateTokenResponseObject, error)
- func (s AccessService) CreateUser(ctx context.Context, req accessgen.CreateUserRequestObject) (accessgen.CreateUserResponseObject, error)
- func (s AccessService) DeleteGlobalEnvironment(ctx context.Context, req accessgen.DeleteGlobalEnvironmentRequestObject) (accessgen.DeleteGlobalEnvironmentResponseObject, error)
- func (s AccessService) DeleteGlobalRole(ctx context.Context, req accessgen.DeleteGlobalRoleRequestObject) (accessgen.DeleteGlobalRoleResponseObject, error)
- func (s AccessService) DeleteGroup(ctx context.Context, req accessgen.DeleteGroupRequestObject) (accessgen.DeleteGroupResponseObject, error)
- func (s AccessService) DeleteOidcConfiguration(ctx context.Context, req accessgen.DeleteOidcConfigurationRequestObject) (accessgen.DeleteOidcConfigurationResponseObject, error)
- func (s AccessService) DeleteOidcIdentityMapping(ctx context.Context, req accessgen.DeleteOidcIdentityMappingRequestObject) (accessgen.DeleteOidcIdentityMappingResponseObject, error)
- func (s AccessService) DeletePermission(ctx context.Context, req accessgen.DeletePermissionRequestObject) (accessgen.DeletePermissionResponseObject, error)
- func (s AccessService) DeletePermissionResource(ctx context.Context, req accessgen.DeletePermissionResourceRequestObject) (accessgen.DeletePermissionResourceResponseObject, error)
- func (s AccessService) DeleteUser(ctx context.Context, req accessgen.DeleteUserRequestObject) (accessgen.DeleteUserResponseObject, error)
- func (s AccessService) ExpirePasswordForAllUsers(ctx context.Context, _ accessgen.ExpirePasswordForAllUsersRequestObject) (accessgen.ExpirePasswordForAllUsersResponseObject, error)
- func (s AccessService) ExpireUserPassword(ctx context.Context, req accessgen.ExpireUserPasswordRequestObject) (accessgen.ExpireUserPasswordResponseObject, error)
- func (s AccessService) GetAccessUserLockPolicy(ctx context.Context, _ accessgen.GetAccessUserLockPolicyRequestObject) (accessgen.GetAccessUserLockPolicyResponseObject, error)
- func (s AccessService) GetAccessVersion(context.Context, accessgen.GetAccessVersionRequestObject) (accessgen.GetAccessVersionResponseObject, error)
- func (s AccessService) GetAllGlobalRoles(ctx context.Context, _ accessgen.GetAllGlobalRolesRequestObject) (accessgen.GetAllGlobalRolesResponseObject, error)
- func (s AccessService) GetAllOidcConfigurations(ctx context.Context, _ accessgen.GetAllOidcConfigurationsRequestObject) (accessgen.GetAllOidcConfigurationsResponseObject, error)
- func (s AccessService) GetBasicAuthenticationStatus(ctx context.Context, _ accessgen.GetBasicAuthenticationStatusRequestObject) (accessgen.GetBasicAuthenticationStatusResponseObject, error)
- func (s AccessService) GetGlobalEnvironments(ctx context.Context, _ accessgen.GetGlobalEnvironmentsRequestObject) (accessgen.GetGlobalEnvironmentsResponseObject, error)
- func (s AccessService) GetGlobalRole(ctx context.Context, req accessgen.GetGlobalRoleRequestObject) (accessgen.GetGlobalRoleResponseObject, error)
- func (s AccessService) GetGroupDetails(ctx context.Context, req accessgen.GetGroupDetailsRequestObject) (accessgen.GetGroupDetailsResponseObject, error)
- func (s AccessService) GetGroupList(ctx context.Context, req accessgen.GetGroupListRequestObject) (accessgen.GetGroupListResponseObject, error)
- func (s AccessService) GetOidcConfiguration(ctx context.Context, req accessgen.GetOidcConfigurationRequestObject) (accessgen.GetOidcConfigurationResponseObject, error)
- func (s AccessService) GetOidcIdentityMappingByName(ctx context.Context, req accessgen.GetOidcIdentityMappingByNameRequestObject) (accessgen.GetOidcIdentityMappingByNameResponseObject, error)
- func (s AccessService) GetOidcIdentityMappings(ctx context.Context, req accessgen.GetOidcIdentityMappingsRequestObject) (accessgen.GetOidcIdentityMappingsResponseObject, error)
- func (s AccessService) GetPermissionDetails(ctx context.Context, req accessgen.GetPermissionDetailsRequestObject) (accessgen.GetPermissionDetailsResponseObject, error)
- func (s AccessService) GetPermissionResource(ctx context.Context, req accessgen.GetPermissionResourceRequestObject) (accessgen.GetPermissionResourceResponseObject, error)
- func (s AccessService) GetPermissions(ctx context.Context, req accessgen.GetPermissionsRequestObject) (accessgen.GetPermissionsResponseObject, error)
- func (s AccessService) GetTokenById(ctx context.Context, req accessgen.GetTokenByIdRequestObject) (accessgen.GetTokenByIdResponseObject, error)
- func (s AccessService) GetTokenDefaultExpiry(ctx context.Context, _ accessgen.GetTokenDefaultExpiryRequestObject) (accessgen.GetTokenDefaultExpiryResponseObject, error)
- func (s AccessService) GetTokens(ctx context.Context, req accessgen.GetTokensRequestObject) (accessgen.GetTokensResponseObject, error)
- func (s AccessService) GetUserDetails(ctx context.Context, req accessgen.GetUserDetailsRequestObject) (accessgen.GetUserDetailsResponseObject, error)
- func (s AccessService) GetUserList(ctx context.Context, req accessgen.GetUserListRequestObject) (accessgen.GetUserListResponseObject, error)
- func (s AccessService) OidcTokenExchange(ctx context.Context, req accessgen.OidcTokenExchangeRequestObject) (accessgen.OidcTokenExchangeResponseObject, error)
- func (s AccessService) RenameGlobalEnvironment(ctx context.Context, req accessgen.RenameGlobalEnvironmentRequestObject) (accessgen.RenameGlobalEnvironmentResponseObject, error)
- func (s AccessService) ReplaceGroup(ctx context.Context, req accessgen.ReplaceGroupRequestObject) (accessgen.ReplaceGroupResponseObject, error)
- func (s AccessService) ReplacePermissionResource(ctx context.Context, req accessgen.ReplacePermissionResourceRequestObject) (accessgen.ReplacePermissionResourceResponseObject, error)
- func (s AccessService) RevokeTokenById(ctx context.Context, req accessgen.RevokeTokenByIdRequestObject) (accessgen.RevokeTokenByIdResponseObject, error)
- func (s AccessService) RevokeTokenByValue(ctx context.Context, req accessgen.RevokeTokenByValueRequestObject) (accessgen.RevokeTokenByValueResponseObject, error)
- func (s AccessService) SetBasicAuthenticationStatus(ctx context.Context, req accessgen.SetBasicAuthenticationStatusRequestObject) (accessgen.SetBasicAuthenticationStatusResponseObject, error)
- func (s AccessService) SetTokenDefaultExpiry(ctx context.Context, req accessgen.SetTokenDefaultExpiryRequestObject) (accessgen.SetTokenDefaultExpiryResponseObject, error)
- func (s AccessService) UnexpirePasswordForAllUsers(ctx context.Context, _ accessgen.UnexpirePasswordForAllUsersRequestObject) (accessgen.UnexpirePasswordForAllUsersResponseObject, error)
- func (s AccessService) UnlockUser(ctx context.Context, req accessgen.UnlockUserRequestObject) (accessgen.UnlockUserResponseObject, error)
- func (s AccessService) UpdateGlobalRole(ctx context.Context, req accessgen.UpdateGlobalRoleRequestObject) (accessgen.UpdateGlobalRoleResponseObject, error)
- func (s AccessService) UpdateGroup(ctx context.Context, req accessgen.UpdateGroupRequestObject) (accessgen.UpdateGroupResponseObject, error)
- func (s AccessService) UpdateGroupMembers(ctx context.Context, req accessgen.UpdateGroupMembersRequestObject) (accessgen.UpdateGroupMembersResponseObject, error)
- func (s AccessService) UpdateOidcConfiguration(ctx context.Context, req accessgen.UpdateOidcConfigurationRequestObject) (accessgen.UpdateOidcConfigurationResponseObject, error)
- func (s AccessService) UpdateOidcIdentityMapping(ctx context.Context, req accessgen.UpdateOidcIdentityMappingRequestObject) (accessgen.UpdateOidcIdentityMappingResponseObject, error)
- func (s AccessService) UpdatePasswordPolicy(ctx context.Context, req accessgen.UpdatePasswordPolicyRequestObject) (accessgen.UpdatePasswordPolicyResponseObject, error)
- func (s AccessService) UpdatePermissionResource(ctx context.Context, req accessgen.UpdatePermissionResourceRequestObject) (accessgen.UpdatePermissionResourceResponseObject, error)
- func (s AccessService) UpdateUser(ctx context.Context, req accessgen.UpdateUserRequestObject) (accessgen.UpdateUserResponseObject, error)
- func (s AccessService) UpdateUserGroups(ctx context.Context, req accessgen.UpdateUserGroupsRequestObject) (accessgen.UpdateUserGroupsResponseObject, error)
- type AuthnOptions
- type Deps
- type RequestDetails
- type SecurityAPI
- func (s SecurityAPI) ActivateArtifactoryKeyEncryption(ctx context.Context, _ artgen.ActivateArtifactoryKeyEncryptionRequestObject) (artgen.ActivateArtifactoryKeyEncryptionResponseObject, error)
- func (s SecurityAPI) AddCertificate(ctx context.Context, req artgen.AddCertificateRequestObject) (artgen.AddCertificateResponseObject, error)
- func (s SecurityAPI) ChangePassword(ctx context.Context, req artgen.ChangePasswordRequestObject) (artgen.ChangePasswordResponseObject, error)
- func (s SecurityAPI) ClearAPIRestriction(ctx context.Context, req artgen.ClearAPIRestrictionRequestObject) (artgen.ClearAPIRestrictionResponseObject, error)
- func (s SecurityAPI) ConfigureUserLockPolicy(ctx context.Context, req artgen.ConfigureUserLockPolicyRequestObject) (artgen.ConfigureUserLockPolicyResponseObject, error)
- func (s SecurityAPI) CreateApiKey(ctx context.Context, _ artgen.CreateApiKeyRequestObject) (artgen.CreateApiKeyResponseObject, error)
- func (s SecurityAPI) CreateKeyPair(ctx context.Context, req artgen.CreateKeyPairRequestObject) (artgen.CreateKeyPairResponseObject, error)
- func (s SecurityAPI) CreateOrReplaceGroup(ctx context.Context, req artgen.CreateOrReplaceGroupRequestObject) (artgen.CreateOrReplaceGroupResponseObject, error)
- func (s SecurityAPI) CreateOrReplacePermissionTarget(ctx context.Context, req artgen.CreateOrReplacePermissionTargetRequestObject) (artgen.CreateOrReplacePermissionTargetResponseObject, error)
- func (s SecurityAPI) CreateOrReplacePermissionTargetV2(ctx context.Context, req artgen.CreateOrReplacePermissionTargetV2RequestObject) (artgen.CreateOrReplacePermissionTargetV2ResponseObject, error)
- func (s SecurityAPI) CreateOrReplaceUser(ctx context.Context, req artgen.CreateOrReplaceUserRequestObject) (artgen.CreateOrReplaceUserResponseObject, error)
- func (s SecurityAPI) CreatePermissionTargetV2(ctx context.Context, req artgen.CreatePermissionTargetV2RequestObject) (artgen.CreatePermissionTargetV2ResponseObject, error)
- func (s SecurityAPI) DeactivateArtifactoryKeyEncryption(ctx context.Context, _ artgen.DeactivateArtifactoryKeyEncryptionRequestObject) (artgen.DeactivateArtifactoryKeyEncryptionResponseObject, error)
- func (s SecurityAPI) DeleteCertificate(ctx context.Context, req artgen.DeleteCertificateRequestObject) (artgen.DeleteCertificateResponseObject, error)
- func (s SecurityAPI) DeleteGroup(ctx context.Context, req artgen.DeleteGroupRequestObject) (artgen.DeleteGroupResponseObject, error)
- func (s SecurityAPI) DeleteKeyPair(ctx context.Context, req artgen.DeleteKeyPairRequestObject) (artgen.DeleteKeyPairResponseObject, error)
- func (s SecurityAPI) DeletePermissionTarget(ctx context.Context, req artgen.DeletePermissionTargetRequestObject) (artgen.DeletePermissionTargetResponseObject, error)
- func (s SecurityAPI) DeletePermissionTargetV2(ctx context.Context, req artgen.DeletePermissionTargetV2RequestObject) (artgen.DeletePermissionTargetV2ResponseObject, error)
- func (s SecurityAPI) DeleteUser(ctx context.Context, req artgen.DeleteUserRequestObject) (artgen.DeleteUserResponseObject, error)
- func (s SecurityAPI) ExpirePasswordForAllUsers(ctx context.Context, _ artgen.ExpirePasswordForAllUsersRequestObject) (artgen.ExpirePasswordForAllUsersResponseObject, error)
- func (s SecurityAPI) ExpirePasswordForMultipleUsers(ctx context.Context, req artgen.ExpirePasswordForMultipleUsersRequestObject) (artgen.ExpirePasswordForMultipleUsersResponseObject, error)
- func (s SecurityAPI) ExpirePasswordForSingleUser(ctx context.Context, req artgen.ExpirePasswordForSingleUserRequestObject) (artgen.ExpirePasswordForSingleUserResponseObject, error)
- func (s SecurityAPI) GetAPIRestriction(ctx context.Context, req artgen.GetAPIRestrictionRequestObject) (artgen.GetAPIRestrictionResponseObject, error)
- func (s SecurityAPI) GetAPIRestrictionAudit(ctx context.Context, req artgen.GetAPIRestrictionAuditRequestObject) (artgen.GetAPIRestrictionAuditResponseObject, error)
- func (s SecurityAPI) GetAllKeyPairs(ctx context.Context, _ artgen.GetAllKeyPairsRequestObject) (artgen.GetAllKeyPairsResponseObject, error)
- func (s SecurityAPI) GetApiKey(ctx context.Context, _ artgen.GetApiKeyRequestObject) (artgen.GetApiKeyResponseObject, error)
- func (s SecurityAPI) GetCertificates(ctx context.Context, _ artgen.GetCertificatesRequestObject) (artgen.GetCertificatesResponseObject, error)
- func (s SecurityAPI) GetGroupDetails(ctx context.Context, req artgen.GetGroupDetailsRequestObject) (artgen.GetGroupDetailsResponseObject, error)
- func (s SecurityAPI) GetGroups(ctx context.Context, _ artgen.GetGroupsRequestObject) (artgen.GetGroupsResponseObject, error)
- func (s SecurityAPI) GetKeyPair(ctx context.Context, req artgen.GetKeyPairRequestObject) (artgen.GetKeyPairResponseObject, error)
- func (s SecurityAPI) GetKeyPairPublicKeyPerRepository(ctx context.Context, req artgen.GetKeyPairPublicKeyPerRepositoryRequestObject) (artgen.GetKeyPairPublicKeyPerRepositoryResponseObject, error)
- func (s SecurityAPI) GetLegacyTokens(ctx context.Context, _ artgen.GetLegacyTokensRequestObject) (artgen.GetLegacyTokensResponseObject, error)
- func (s SecurityAPI) GetLockedOutUsers(ctx context.Context, _ artgen.GetLockedOutUsersRequestObject) (artgen.GetLockedOutUsersResponseObject, error)
- func (s SecurityAPI) GetPasswordExpirationPolicy(ctx context.Context, _ artgen.GetPasswordExpirationPolicyRequestObject) (artgen.GetPasswordExpirationPolicyResponseObject, error)
- func (s SecurityAPI) GetPermissionTargetDetails(ctx context.Context, req artgen.GetPermissionTargetDetailsRequestObject) (artgen.GetPermissionTargetDetailsResponseObject, error)
- func (s SecurityAPI) GetPermissionTargetDetailsV2(ctx context.Context, req artgen.GetPermissionTargetDetailsV2RequestObject) (artgen.GetPermissionTargetDetailsV2ResponseObject, error)
- func (s SecurityAPI) GetPermissionTargets(ctx context.Context, _ artgen.GetPermissionTargetsRequestObject) (artgen.GetPermissionTargetsResponseObject, error)
- func (s SecurityAPI) GetPermissionTargetsByGroupV2(ctx context.Context, req artgen.GetPermissionTargetsByGroupV2RequestObject) (artgen.GetPermissionTargetsByGroupV2ResponseObject, error)
- func (s SecurityAPI) GetPermissionTargetsByUserV2(ctx context.Context, req artgen.GetPermissionTargetsByUserV2RequestObject) (artgen.GetPermissionTargetsByUserV2ResponseObject, error)
- func (s SecurityAPI) GetPermissionTargetsV2(ctx context.Context, _ artgen.GetPermissionTargetsV2RequestObject) (artgen.GetPermissionTargetsV2ResponseObject, error)
- func (s SecurityAPI) GetUserDetails(ctx context.Context, req artgen.GetUserDetailsRequestObject) (artgen.GetUserDetailsResponseObject, error)
- func (s SecurityAPI) GetUserEncryptedPassword(ctx context.Context, _ artgen.GetUserEncryptedPasswordRequestObject) (artgen.GetUserEncryptedPasswordResponseObject, error)
- func (s SecurityAPI) GetUserLockPolicy(ctx context.Context, _ artgen.GetUserLockPolicyRequestObject) (artgen.GetUserLockPolicyResponseObject, error)
- func (s SecurityAPI) GetUsers(ctx context.Context, _ artgen.GetUsersRequestObject) (artgen.GetUsersResponseObject, error)
- func (s SecurityAPI) PermissionTargetExistenceCheckV2(ctx context.Context, req artgen.PermissionTargetExistenceCheckV2RequestObject) (artgen.PermissionTargetExistenceCheckV2ResponseObject, error)
- func (s SecurityAPI) RegenerateApiKey(ctx context.Context, _ artgen.RegenerateApiKeyRequestObject) (artgen.RegenerateApiKeyResponseObject, error)
- func (s SecurityAPI) RevokeApiKey(ctx context.Context, req artgen.RevokeApiKeyRequestObject) (artgen.RevokeApiKeyResponseObject, error)
- func (s SecurityAPI) RevokeUserApiKey(ctx context.Context, req artgen.RevokeUserApiKeyRequestObject) (artgen.RevokeUserApiKeyResponseObject, error)
- func (s SecurityAPI) SetAPIRestriction(ctx context.Context, req artgen.SetAPIRestrictionRequestObject) (artgen.SetAPIRestrictionResponseObject, error)
- func (s SecurityAPI) SetPasswordExpirationPolicy(ctx context.Context, req artgen.SetPasswordExpirationPolicyRequestObject) (artgen.SetPasswordExpirationPolicyResponseObject, error)
- func (s SecurityAPI) UnexpirePasswordForSingleUser(ctx context.Context, req artgen.UnexpirePasswordForSingleUserRequestObject) (artgen.UnexpirePasswordForSingleUserResponseObject, error)
- func (s SecurityAPI) UnlockAllLockedOutUsers(ctx context.Context, _ artgen.UnlockAllLockedOutUsersRequestObject) (artgen.UnlockAllLockedOutUsersResponseObject, error)
- func (s SecurityAPI) UnlockLockedOutUser(ctx context.Context, req artgen.UnlockLockedOutUserRequestObject) (artgen.UnlockLockedOutUserResponseObject, error)
- func (s SecurityAPI) UnlockLockedOutUsers(ctx context.Context, req artgen.UnlockLockedOutUsersRequestObject) (artgen.UnlockLockedOutUsersResponseObject, error)
- func (s SecurityAPI) UpdateGroup(ctx context.Context, req artgen.UpdateGroupRequestObject) (artgen.UpdateGroupResponseObject, error)
- func (s SecurityAPI) UpdateKeyPair(ctx context.Context, req artgen.UpdateKeyPairRequestObject) (artgen.UpdateKeyPairResponseObject, error)
- func (s SecurityAPI) UpdateUser(ctx context.Context, req artgen.UpdateUserRequestObject) (artgen.UpdateUserResponseObject, error)
- func (s SecurityAPI) VerifyKeyPair(ctx context.Context, req artgen.VerifyKeyPairRequestObject) (artgen.VerifyKeyPairResponseObject, error)
- type Server
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIRecoveryContext ¶
APIRecoveryContext marks a recovery request (APIRecoveryRequest) so that the authenticator verifies its credentials even while the caller's API restriction is in force, and bounds the request to five seconds. The flag grants no authority: the handlers still require an administrator.
func APIRecoveryRequest ¶
APIRecoveryRequest reports the administrator's recovery requests: reading, setting and lifting a user's API restriction and reading the audit. They pass the restriction check (CheckAPIRestriction), and the request limiter serves them from a reserve of their own, so that a restriction can always be lifted.
func Authenticate ¶
func Authenticate(o AuthnOptions) func(http.Handler) http.Handler
Authenticate puts the request's principal in its context. It decides in this order, and the order matters:
- A self-authenticated route passes untouched.
- So does a request a skip reports, credentials or not, the skips asked in order. npm's login and logout come first (npmUserPath): they check the password and the token they carry themselves, and a stale credential read there could suspend the very login that replaces it. Then a protocol's absent path, such as Go's checksum database, which its router answers 404 whoever asks, a host route served to anyone, such as Terraform's discovery document, and a signed URL, such as Terraform's downloads, whose handler checks the signature (pkgroute.Protocol.SkipsAuthentication).
- Credentials that do not verify answer 401 at once, even on a public route, as Artifactory does: a client with a wrong password learns it on its first call. A refused API key (refusedAPIKey) and a NuGet client's refused password (refusedNuGetPassword) answer 403 instead, and so do a locked account, an expired password and a suspended login, each with the challenge (entryPoint). An expired password may still change itself (ownPasswordChange), and a registry token is good for the registry alone (decision 0005).
- The exception is an expired Bearer access token on refreshRoute (expiredRefresh).
- A principal that verified is authorised once (authn.Authorize): its permissions are evaluated for the request, and the principal is stored with that evaluator (authn.WithAuthorized), which handlers ask every question through authn.DeciderFrom. The credential keepers add to its context first, in order. The principal's name goes to the access log (httpkit.NoteUser).
- Without credentials, a path that challenges anonymous requests answers 401 even while anonymous access is on (decision 0031).
- Otherwise the request acts as anonymous, authorised the same way, when anonymous access is on.
- With anonymous access off, only public routes answer.
func PlusAsSpace ¶
PlusAsSpace rewrites an unescaped "+" in those paths to an escaped space before chi routes the request, so the generated binders decode it as one. A plus sent as %2B is not a "+" in the escaped path and stays a plus, which keeps names that contain one reachable. It must run before routing: chi takes the path parameters from the escaped path as it matches.
func PublicRoutes ¶
PublicRoutes returns "METHOD path" of Access's routes that answer without credentials while anonymous access is off (accessPublicRoutes), in a new map to which the router adds the routes of its other modules (AuthnOptions.PublicRoutes).
func SlashCollections ¶
SlashCollections returns the access collection that the Terraform provider calls with a trailing slash, mapped to its path without one, for the router's rewrite of collection paths: the provider creates key pairs with POST /api/security/keypair/ (its KeypairEndPoint), which chi would otherwise read as a key pair with an empty name.
Types ¶
type AccessService ¶
type AccessService struct {
// contains filtered or unexported fields
}
AccessService implements the access spec's operations. It is the access spec's partial strict server: the composition root embeds it beside the generated stubs, which answer 501 for every operation it leaves out.
func (AccessService) ChangeUserPassword ¶
func (s AccessService) ChangeUserPassword( ctx context.Context, req accessgen.ChangeUserPasswordRequestObject, ) (accessgen.ChangeUserPasswordResponseObject, error)
ChangeUserPassword sets a user's password (PUT /access/api/v2/users/{username}/password): an administrator sets anyone's, and a user its own, even once it has expired, but not through a narrowed token.
func (AccessService) ConfigureAccessUserLockPolicy ¶
func (s AccessService) ConfigureAccessUserLockPolicy( ctx context.Context, req accessgen.ConfigureAccessUserLockPolicyRequestObject, ) (accessgen.ConfigureAccessUserLockPolicyResponseObject, error)
ConfigureAccessUserLockPolicy replaces the policy. An omitted field is stored as 0 or false, not as its default: Access's request model has plain numbers and booleans, and JFrog documents the consequences (omitting attempts turns locking off).
func (AccessService) CreateGlobalEnvironment ¶
func (s AccessService) CreateGlobalEnvironment( ctx context.Context, req accessgen.CreateGlobalEnvironmentRequestObject, ) (accessgen.CreateGlobalEnvironmentResponseObject, error)
CreateGlobalEnvironment creates a global environment for an administrator (POST /access/api/v1/environments); a taken name is a 409.
func (AccessService) CreateGlobalRole ¶
func (s AccessService) CreateGlobalRole( ctx context.Context, req accessgen.CreateGlobalRoleRequestObject, ) (accessgen.CreateGlobalRoleResponseObject, error)
CreateGlobalRole answers 201 with {"code":"OK","message":"Role '<name>' created"}, as JFrog's spec documents; the platform provider then reads the role back.
func (AccessService) CreateGroup ¶
func (s AccessService) CreateGroup( ctx context.Context, req accessgen.CreateGroupRequestObject, ) (accessgen.CreateGroupResponseObject, error)
CreateGroup creates a group for an administrator (POST /access/api/v2/groups).
func (AccessService) CreateOidcConfiguration ¶
func (s AccessService) CreateOidcConfiguration( ctx context.Context, req accessgen.CreateOidcConfigurationRequestObject, ) (accessgen.CreateOidcConfigurationResponseObject, error)
CreateOidcConfiguration answers 200, not 201: the jfrog/platform provider expects exactly 200.
func (AccessService) CreateOidcIdentityMapping ¶
func (s AccessService) CreateOidcIdentityMapping( ctx context.Context, req accessgen.CreateOidcIdentityMappingRequestObject, ) (accessgen.CreateOidcIdentityMappingResponseObject, error)
CreateOidcIdentityMapping creates an identity mapping of a provider for an administrator (POST /access/api/v1/oidc/{provider_name}/identity_mappings).
func (AccessService) CreatePasswordPolicy ¶
func (s AccessService) CreatePasswordPolicy( ctx context.Context, req accessgen.CreatePasswordPolicyRequestObject, ) (accessgen.CreatePasswordPolicyResponseObject, error)
CreatePasswordPolicy replaces the whole policy: an omitted field returns to its default, as JFrog documents for this PUT.
func (AccessService) CreatePermission ¶
func (s AccessService) CreatePermission( ctx context.Context, req accessgen.CreatePermissionRequestObject, ) (accessgen.CreatePermissionResponseObject, error)
CreatePermission creates a permission and returns it as stored, 201.
func (AccessService) CreateToken ¶
func (s AccessService) CreateToken( ctx context.Context, req accessgen.CreateTokenRequestObject, ) (accessgen.CreateTokenResponseObject, error)
CreateToken mints or refreshes a token. The body may be JSON (the Terraform provider) or a form (the JFrog CLI); both carry the same fields.
func (AccessService) CreateUser ¶
func (s AccessService) CreateUser( ctx context.Context, req accessgen.CreateUserRequestObject, ) (accessgen.CreateUserResponseObject, error)
CreateUser creates a user for an administrator (POST /access/api/v2/users).
func (AccessService) DeleteGlobalEnvironment ¶
func (s AccessService) DeleteGlobalEnvironment( ctx context.Context, req accessgen.DeleteGlobalEnvironmentRequestObject, ) (accessgen.DeleteGlobalEnvironmentResponseObject, error)
DeleteGlobalEnvironment refuses DEV, PROD and environments still in use with 400, as the operation's description says; its declared responses do not list the 400, so the error carries it.
func (AccessService) DeleteGlobalRole ¶
func (s AccessService) DeleteGlobalRole( ctx context.Context, req accessgen.DeleteGlobalRoleRequestObject, ) (accessgen.DeleteGlobalRoleResponseObject, error)
DeleteGlobalRole deletes a global role for an administrator (DELETE /access/api/v1/roles/{role}); a built-in role or one in use is a 400.
func (AccessService) DeleteGroup ¶
func (s AccessService) DeleteGroup( ctx context.Context, req accessgen.DeleteGroupRequestObject, ) (accessgen.DeleteGroupResponseObject, error)
DeleteGroup deletes a group for an administrator (DELETE /access/api/v2/groups/{name}).
func (AccessService) DeleteOidcConfiguration ¶
func (s AccessService) DeleteOidcConfiguration( ctx context.Context, req accessgen.DeleteOidcConfigurationRequestObject, ) (accessgen.DeleteOidcConfigurationResponseObject, error)
DeleteOidcConfiguration deletes an OIDC provider for an administrator (DELETE /access/api/v1/oidc/{name}).
func (AccessService) DeleteOidcIdentityMapping ¶
func (s AccessService) DeleteOidcIdentityMapping( ctx context.Context, req accessgen.DeleteOidcIdentityMappingRequestObject, ) (accessgen.DeleteOidcIdentityMappingResponseObject, error)
DeleteOidcIdentityMapping deletes an identity mapping for an administrator (DELETE /access/api/v1/oidc/{provider_name}/identity_mappings/{mapping_name}).
func (AccessService) DeletePermission ¶
func (s AccessService) DeletePermission( ctx context.Context, req accessgen.DeletePermissionRequestObject, ) (accessgen.DeletePermissionResponseObject, error)
DeletePermission removes a permission, 204.
func (AccessService) DeletePermissionResource ¶
func (s AccessService) DeletePermissionResource( ctx context.Context, req accessgen.DeletePermissionResourceRequestObject, ) (accessgen.DeletePermissionResourceResponseObject, error)
DeletePermissionResource removes one section, 204.
func (AccessService) DeleteUser ¶
func (s AccessService) DeleteUser( ctx context.Context, req accessgen.DeleteUserRequestObject, ) (accessgen.DeleteUserResponseObject, error)
DeleteUser deletes a user for an administrator (DELETE /access/api/v2/users/{username}).
func (AccessService) ExpirePasswordForAllUsers ¶
func (s AccessService) ExpirePasswordForAllUsers( ctx context.Context, _ accessgen.ExpirePasswordForAllUsersRequestObject, ) (accessgen.ExpirePasswordForAllUsersResponseObject, error)
ExpirePasswordForAllUsers expires every internal user's password for an administrator (POST /access/api/v2/users/expire_password_for_all_users).
func (AccessService) ExpireUserPassword ¶
func (s AccessService) ExpireUserPassword( ctx context.Context, req accessgen.ExpireUserPasswordRequestObject, ) (accessgen.ExpireUserPasswordResponseObject, error)
ExpireUserPassword expires a user's password for an administrator (POST /access/api/v2/users/{username}/password/expire).
func (AccessService) GetAccessUserLockPolicy ¶
func (s AccessService) GetAccessUserLockPolicy( ctx context.Context, _ accessgen.GetAccessUserLockPolicyRequestObject, ) (accessgen.GetAccessUserLockPolicyResponseObject, error)
GetAccessUserLockPolicy returns the Access view of the state that /artifactory/api/security/userLockPolicy and the password expiration policy also read.
func (AccessService) GetAccessVersion ¶
func (s AccessService) GetAccessVersion( context.Context, accessgen.GetAccessVersionRequestObject, ) (accessgen.GetAccessVersionResponseObject, error)
GetAccessVersion answers with the compatibility version as Access's name and version, because clients compare it to decide what Access supports (decision 0005).
func (AccessService) GetAllGlobalRoles ¶
func (s AccessService) GetAllGlobalRoles( ctx context.Context, _ accessgen.GetAllGlobalRolesRequestObject, ) (accessgen.GetAllGlobalRolesResponseObject, error)
GetAllGlobalRoles lists the global roles for an administrator (GET /access/api/v1/roles).
func (AccessService) GetAllOidcConfigurations ¶
func (s AccessService) GetAllOidcConfigurations( ctx context.Context, _ accessgen.GetAllOidcConfigurationsRequestObject, ) (accessgen.GetAllOidcConfigurationsResponseObject, error)
GetAllOidcConfigurations lists the OIDC providers for an administrator (GET /access/api/v1/oidc).
func (AccessService) GetBasicAuthenticationStatus ¶
func (s AccessService) GetBasicAuthenticationStatus( ctx context.Context, _ accessgen.GetBasicAuthenticationStatusRequestObject, ) (accessgen.GetBasicAuthenticationStatusResponseObject, error)
GetBasicAuthenticationStatus answers an administrator whether Basic authentication with a password is on (GET /access/api/v1/config/security/authentication/basic_authentication_enabled).
func (AccessService) GetGlobalEnvironments ¶
func (s AccessService) GetGlobalEnvironments( ctx context.Context, _ accessgen.GetGlobalEnvironmentsRequestObject, ) (accessgen.GetGlobalEnvironmentsResponseObject, error)
GetGlobalEnvironments lists the global environments for an administrator (GET /access/api/v1/environments).
func (AccessService) GetGlobalRole ¶
func (s AccessService) GetGlobalRole( ctx context.Context, req accessgen.GetGlobalRoleRequestObject, ) (accessgen.GetGlobalRoleResponseObject, error)
GetGlobalRole returns a global role to an administrator (GET /access/api/v1/roles/{role}).
func (AccessService) GetGroupDetails ¶
func (s AccessService) GetGroupDetails( ctx context.Context, req accessgen.GetGroupDetailsRequestObject, ) (accessgen.GetGroupDetailsResponseObject, error)
GetGroupDetails returns a group to a caller that may read identities (GET /access/api/v2/groups/{name}).
func (AccessService) GetGroupList ¶
func (s AccessService) GetGroupList( ctx context.Context, req accessgen.GetGroupListRequestObject, ) (accessgen.GetGroupListResponseObject, error)
GetGroupList lists groups a page at a time for a caller that may read identities: an administrator, or a token whose scope covers identities:r (GET /access/api/v2/groups).
func (AccessService) GetOidcConfiguration ¶
func (s AccessService) GetOidcConfiguration( ctx context.Context, req accessgen.GetOidcConfigurationRequestObject, ) (accessgen.GetOidcConfigurationResponseObject, error)
GetOidcConfiguration returns an OIDC provider to an administrator (GET /access/api/v1/oidc/{name}).
func (AccessService) GetOidcIdentityMappingByName ¶
func (s AccessService) GetOidcIdentityMappingByName( ctx context.Context, req accessgen.GetOidcIdentityMappingByNameRequestObject, ) (accessgen.GetOidcIdentityMappingByNameResponseObject, error)
GetOidcIdentityMappingByName returns an identity mapping to an administrator (GET /access/api/v1/oidc/{provider_name}/identity_mappings/{mapping_name}).
func (AccessService) GetOidcIdentityMappings ¶
func (s AccessService) GetOidcIdentityMappings( ctx context.Context, req accessgen.GetOidcIdentityMappingsRequestObject, ) (accessgen.GetOidcIdentityMappingsResponseObject, error)
GetOidcIdentityMappings lists a provider's identity mappings, of one project when the query names it, for an administrator (GET /access/api/v1/oidc/{provider_name}/identity_mappings).
func (AccessService) GetPermissionDetails ¶
func (s AccessService) GetPermissionDetails( ctx context.Context, req accessgen.GetPermissionDetailsRequestObject, ) (accessgen.GetPermissionDetailsResponseObject, error)
GetPermissionDetails returns one permission to an administrator, a Manage Resources holder or a system:permissions:r token (getpermissiondetails.json).
func (AccessService) GetPermissionResource ¶
func (s AccessService) GetPermissionResource( ctx context.Context, req accessgen.GetPermissionResourceRequestObject, ) (accessgen.GetPermissionResourceResponseObject, error)
GetPermissionResource returns one section. It is admin only, as getpermissionresource documents, but for Manage Resources holders, who see every permission whole: a system:permissions:r token, which reads the whole permission, is refused here (#382).
func (AccessService) GetPermissions ¶
func (s AccessService) GetPermissions( ctx context.Context, req accessgen.GetPermissionsRequestObject, ) (accessgen.GetPermissionsResponseObject, error)
GetPermissions pages through the permissions, optionally only those granting given users or groups, as name and uri pairs or, with expand, documents narrowed to those principals' grants. getpermissions.json documents the cursor as the name of the previous page's last permission, passed back as the next call's cursor, so a page starts after that name rather than at it, which would repeat it. The store reads only the page and one row past it, which says whether a next cursor is due, so a late page costs what the first does (#1408).
func (AccessService) GetTokenById ¶
func (s AccessService) GetTokenById( ctx context.Context, req accessgen.GetTokenByIdRequestObject, ) (accessgen.GetTokenByIdResponseObject, error)
GetTokenById returns one token's metadata. A non-revocable token is still found by its id: the artifactory_scoped_token resource reads its token back after creating it, and drops it from state on a 404.
func (AccessService) GetTokenDefaultExpiry ¶
func (s AccessService) GetTokenDefaultExpiry( ctx context.Context, _ accessgen.GetTokenDefaultExpiryRequestObject, ) (accessgen.GetTokenDefaultExpiryResponseObject, error)
GetTokenDefaultExpiry answers the default lifetime in seconds. Admin only.
func (AccessService) GetTokens ¶
func (s AccessService) GetTokens( ctx context.Context, req accessgen.GetTokensRequestObject, ) (accessgen.GetTokensResponseObject, error)
GetTokens lists the caller's tokens, or every token for an administrator, keeping only those with the scope the scope parameter names.
func (AccessService) GetUserDetails ¶
func (s AccessService) GetUserDetails( ctx context.Context, req accessgen.GetUserDetailsRequestObject, ) (accessgen.GetUserDetailsResponseObject, error)
GetUserDetails returns a user to a caller that may read identities, and to the user itself (GET /access/api/v2/users/{username}).
func (AccessService) GetUserList ¶
func (s AccessService) GetUserList( ctx context.Context, req accessgen.GetUserListRequestObject, ) (accessgen.GetUserListResponseObject, error)
GetUserList lists users a page at a time for a caller that may read identities (GET /access/api/v2/users).
func (AccessService) OidcTokenExchange ¶
func (s AccessService) OidcTokenExchange( ctx context.Context, req accessgen.OidcTokenExchangeRequestObject, ) (accessgen.OidcTokenExchangeResponseObject, error)
OidcTokenExchange issues an access token for a provider's ID token (RFC 8693). It answers without credentials; the token service must be configured, as for the token API.
func (AccessService) RenameGlobalEnvironment ¶
func (s AccessService) RenameGlobalEnvironment( ctx context.Context, req accessgen.RenameGlobalEnvironmentRequestObject, ) (accessgen.RenameGlobalEnvironmentResponseObject, error)
RenameGlobalEnvironment renames a global environment for an administrator (POST /access/api/v1/environments/{environmentName}/rename); a taken name is a 400, because the spec lists no 409 there.
func (AccessService) ReplaceGroup ¶
func (s AccessService) ReplaceGroup( ctx context.Context, req accessgen.ReplaceGroupRequestObject, ) (accessgen.ReplaceGroupResponseObject, error)
ReplaceGroup creates the group, or replaces it, for an administrator (PUT /access/api/v2/groups/{name}): 201 with the group it created, 200 with the group it replaced. The body is Create a Group's, so a replacement resets every field it leaves out to the create default and replaces the members, as JFrog's Replace or Create a Group page says.
func (AccessService) ReplacePermissionResource ¶
func (s AccessService) ReplacePermissionResource( ctx context.Context, req accessgen.ReplacePermissionResourceRequestObject, ) (accessgen.ReplacePermissionResourceResponseObject, error)
ReplacePermissionResource replaces one section whole, creating it when the permission had none.
func (AccessService) RevokeTokenById ¶
func (s AccessService) RevokeTokenById( ctx context.Context, req accessgen.RevokeTokenByIdRequestObject, ) (accessgen.RevokeTokenByIdResponseObject, error)
RevokeTokenById revokes a token. A non-revocable one is 400, as 7.x answers it (JFrog KB 000005622, which shows the UI's DELETE of such a token failing with 400); revoketokenbyid lists 403 only for a caller without the permission.
func (AccessService) RevokeTokenByValue ¶
func (s AccessService) RevokeTokenByValue( ctx context.Context, req accessgen.RevokeTokenByValueRequestObject, ) (accessgen.RevokeTokenByValueResponseObject, error)
RevokeTokenByValue revokes the token whose JWT or reference token is given. Admin only. An unknown token and a non-revocable one both answer 404, which revoketokenbyvalue documents as "Token not found or not revocable", so the answer does not tell which.
func (AccessService) SetBasicAuthenticationStatus ¶
func (s AccessService) SetBasicAuthenticationStatus( ctx context.Context, req accessgen.SetBasicAuthenticationStatusRequestObject, ) (accessgen.SetBasicAuthenticationStatusResponseObject, error)
SetBasicAuthenticationStatus switches passwords over HTTP Basic on or off. Tokens keep working either way, which is how an administrator turns it back on.
func (AccessService) SetTokenDefaultExpiry ¶
func (s AccessService) SetTokenDefaultExpiry( ctx context.Context, req accessgen.SetTokenDefaultExpiryRequestObject, ) (accessgen.SetTokenDefaultExpiryResponseObject, error)
SetTokenDefaultExpiry sets the default lifetime, in seconds as the token service reads it. Admin only; it applies to tokens created afterwards.
func (AccessService) UnexpirePasswordForAllUsers ¶
func (s AccessService) UnexpirePasswordForAllUsers( ctx context.Context, _ accessgen.UnexpirePasswordForAllUsersRequestObject, ) (accessgen.UnexpirePasswordForAllUsersResponseObject, error)
UnexpirePasswordForAllUsers clears the expired flag on every password for an administrator (POST /access/api/v2/users/unexpire_password_for_all_users).
func (AccessService) UnlockUser ¶
func (s AccessService) UnlockUser( ctx context.Context, req accessgen.UnlockUserRequestObject, ) (accessgen.UnlockUserResponseObject, error)
UnlockUser lifts a user's lockout for an administrator (POST /access/api/v2/users/{username}/unlock); unlocking a user that is not locked succeeds.
func (AccessService) UpdateGlobalRole ¶
func (s AccessService) UpdateGlobalRole( ctx context.Context, req accessgen.UpdateGlobalRoleRequestObject, ) (accessgen.UpdateGlobalRoleResponseObject, error)
UpdateGlobalRole replaces a global role for an administrator (PUT /access/api/v1/roles/{role}).
func (AccessService) UpdateGroup ¶
func (s AccessService) UpdateGroup( ctx context.Context, req accessgen.UpdateGroupRequestObject, ) (accessgen.UpdateGroupResponseObject, error)
UpdateGroup changes the fields a patch sends for an administrator (PATCH /access/api/v2/groups/{name}). The raw body (keepsGroupUpdateBody) tells a field left out from one sent with its stored value.
func (AccessService) UpdateGroupMembers ¶
func (s AccessService) UpdateGroupMembers( ctx context.Context, req accessgen.UpdateGroupMembersRequestObject, ) (accessgen.UpdateGroupMembersResponseObject, error)
UpdateGroupMembers adds and removes a group's members for an administrator (PATCH /access/api/v2/groups/{name}/members).
func (AccessService) UpdateOidcConfiguration ¶
func (s AccessService) UpdateOidcConfiguration( ctx context.Context, req accessgen.UpdateOidcConfigurationRequestObject, ) (accessgen.UpdateOidcConfigurationResponseObject, error)
UpdateOidcConfiguration replaces an OIDC provider for an administrator (PUT /access/api/v1/oidc/{name}).
func (AccessService) UpdateOidcIdentityMapping ¶
func (s AccessService) UpdateOidcIdentityMapping( ctx context.Context, req accessgen.UpdateOidcIdentityMappingRequestObject, ) (accessgen.UpdateOidcIdentityMappingResponseObject, error)
UpdateOidcIdentityMapping replaces an identity mapping for an administrator (PUT /access/api/v1/oidc/{provider_name}/identity_mappings/{mapping_name}).
func (AccessService) UpdatePasswordPolicy ¶
func (s AccessService) UpdatePasswordPolicy( ctx context.Context, req accessgen.UpdatePasswordPolicyRequestObject, ) (accessgen.UpdatePasswordPolicyResponseObject, error)
UpdatePasswordPolicy merges the fields sent into the stored policy.
func (AccessService) UpdatePermissionResource ¶
func (s AccessService) UpdatePermissionResource( ctx context.Context, req accessgen.UpdatePermissionResourceRequestObject, ) (accessgen.UpdatePermissionResourceResponseObject, error)
UpdatePermissionResource merges the body into an existing section.
func (AccessService) UpdateUser ¶
func (s AccessService) UpdateUser( ctx context.Context, req accessgen.UpdateUserRequestObject, ) (accessgen.UpdateUserResponseObject, error)
UpdateUser changes the fields a patch sends for an administrator (PATCH /access/api/v2/users/{username}).
func (AccessService) UpdateUserGroups ¶
func (s AccessService) UpdateUserGroups( ctx context.Context, req accessgen.UpdateUserGroupsRequestObject, ) (accessgen.UpdateUserGroupsResponseObject, error)
UpdateUserGroups adds and removes a user's group memberships for an administrator (PATCH /access/api/v2/users/{username}/groups).
type AuthnOptions ¶
type AuthnOptions struct {
// Auth verifies credentials and answers whether anonymous access is on.
Auth *authn.Authenticator
// Store holds the permissions each principal is authorised with.
Store Store
// SelfAuthenticated holds "METHOD path" of the routes that verify their
// own credential, which pass untouched.
SelfAuthenticated map[string]bool
// Skip reports the requests that pass untouched, credentials or not,
// asked in order.
Skip []func(*http.Request) bool
// RegistryPath reports whether path is the registry's, the only place a
// registry token is good.
RegistryPath func(path string) bool
// ChallengeAnonymous reports whether a request to path without
// credentials is challenged even while anonymous access is on.
ChallengeAnonymous func(path string) bool
// CredentialKeepers each return the context an authenticated request
// goes on with, in order: the hook for the operations that need the
// credential itself, which no other request carries further than here.
CredentialKeepers []func(context.Context, *http.Request, kernel.Principal) context.Context
// PublicRoutes holds "METHOD path" of the routes that answer without
// credentials while anonymous access is off.
PublicRoutes map[string]bool
}
AuthnOptions are the values Authenticate takes from the modules, which the router composes. Credential parsing (credentials) is not among them: every credential form is accepted the same way on every route. RegistryPath and ChallengeAnonymous must be set, because Authenticate calls them without a nil check; the maps and lists may be empty.
type Deps ¶
type Deps struct {
// API is the access module's API. The handlers evaluate a principal the
// middleware did not authorise through its Authorizer.
API accessapi.API
// Store holds the users, groups, permissions, key pairs, certificates,
// tokens, API restrictions, settings and OIDC documents the handlers
// read and write. The router's store is an interface, so a nil one
// converts to a nil Store; a typed nil pointer would not, and the
// operations would call it instead of answering 501.
Store Store
// Authenticator forgets its cached password policies when the security
// API changes them, and recognises the expired access token a legacy
// refresh presents. Nil skips both.
Authenticator *authn.Authenticator
// Tokens issues, refreshes and revokes access tokens; nil answers the
// token APIs and the OIDC exchange 501.
Tokens *token.Service
// IDTokens verifies the subject tokens of the OIDC token exchange and
// caches each provider's signing keys. Nil makes New build one.
IDTokens *idtoken.Verifier
// Settings holds token.allow_basic_auth, which lets a password sent with
// Basic create tokens, and the global environment limit of the roles API.
Settings accessapi.Settings
// PasswordHash is the cost of the passwords the security API sets; the
// zero value is production's.
PasswordHash authn.HashParams
// CompatVersion is the Artifactory version Access reports as its own
// name and version (GetAccessVersion).
CompatVersion string
// Log receives the handlers' internal errors; nil means slog.Default.
Log *slog.Logger
// Repositories is the artifacts module's binding over Store. A key pair
// delete clears the repositories' references to the pair through it in
// the delete's own transaction, so it must take part in the transaction
// its context carries, as the binding over the same store does. The
// permission and role services read the repositories a section names.
Repositories artifactsapi.Repositories
}
Deps is what the access handlers need, which the composition root supplies. A nil Store leaves every operation that reads one answering 501, as a router built to test routing alone answers.
type RequestDetails ¶
type RequestDetails struct {
// Rewrite each rewrite a request's body in place, or leave it unchanged.
Rewrite []func(*http.Request) error
// RawBody each report requests whose raw body a handler reads.
RawBody []func(*http.Request) bool
}
RequestDetails are the access handlers' contributions to the request details the router keeps before a generated server decodes the body.
func DetailRules ¶
func DetailRules() RequestDetails
DetailRules returns the access contributions: the policy writes, whose string-spelled booleans and numbers become JSON types (rewritePolicyBody), and the raw bodies of Access v2 permission creates (keepsPermissionBody) and group updates (keepsGroupUpdateBody).
type SecurityAPI ¶
type SecurityAPI struct {
// contains filtered or unexported fields
}
SecurityAPI implements the artifactory spec's security operations: users, groups, permission targets, key pairs and certificates, API restrictions, passwords and policies, and the legacy tokens. It is a partial strict server of the artifactory spec, which the composition root embeds beside the other partials and the generated stubs.
func (SecurityAPI) ActivateArtifactoryKeyEncryption ¶
func (s SecurityAPI) ActivateArtifactoryKeyEncryption( ctx context.Context, _ artgen.ActivateArtifactoryKeyEncryptionRequestObject, ) (artgen.ActivateArtifactoryKeyEncryptionResponseObject, error)
ActivateArtifactoryKeyEncryption answers an administrator DONE and changes nothing: secrets are sealed at all times (decision 0017), the state 7.x's encrypt puts the configuration in. A user who is not an administrator gets 403 and an anonymous caller 401, as SystemResource's @RolesAllowed(ROLE_ADMIN) refuses them.
func (SecurityAPI) AddCertificate ¶
func (s SecurityAPI) AddCertificate( ctx context.Context, req artgen.AddCertificateRequestObject, ) (artgen.AddCertificateResponseObject, error)
AddCertificate stores a PEM bundle of a certificate and its private key under the alias, replacing any certificate already there.
func (SecurityAPI) ChangePassword ¶
func (s SecurityAPI) ChangePassword( ctx context.Context, req artgen.ChangePasswordRequestObject, ) (artgen.ChangePasswordResponseObject, error)
ChangePassword is the deprecated password change, which names its user in the body and proves the change with the current password. An administrator may name anyone, with the current password all the same; anyone else only itself, and not through a narrowed token (narrowedToken), as the Access v2 change refuses one. An expired password reaches here (ownPasswordChange) with its administrator rights intact, so it is held to its own name.
func (SecurityAPI) ClearAPIRestriction ¶
func (s SecurityAPI) ClearAPIRestriction( ctx context.Context, req artgen.ClearAPIRestrictionRequestObject, ) (artgen.ClearAPIRestrictionResponseObject, error)
ClearAPIRestriction lifts a user's temporary API restriction for an administrator, recording who lifted it (DELETE /artifactory/api/artifactweave/api-restrictions/{userName}).
func (SecurityAPI) ConfigureUserLockPolicy ¶
func (s SecurityAPI) ConfigureUserLockPolicy( ctx context.Context, req artgen.ConfigureUserLockPolicyRequestObject, ) (artgen.ConfigureUserLockPolicyResponseObject, error)
ConfigureUserLockPolicy replaces the lockout settings; omitted fields take their defaults. Disabling the policy also clears every lock.
func (SecurityAPI) CreateApiKey ¶
func (s SecurityAPI) CreateApiKey( ctx context.Context, _ artgen.CreateApiKeyRequestObject, ) (artgen.CreateApiKeyResponseObject, error)
CreateApiKey refuses: API keys are retired (decision 0005).
func (SecurityAPI) CreateKeyPair ¶
func (s SecurityAPI) CreateKeyPair( ctx context.Context, req artgen.CreateKeyPairRequestObject, ) (artgen.CreateKeyPairResponseObject, error)
CreateKeyPair stores a pair, replacing one of the same name as 7.x does (createkeypair). Repositories refer to a pair by name, so those using a replaced pair sign with the new material from the next request. The Terraform provider requires 201 with an empty object either way.
func (SecurityAPI) CreateOrReplaceGroup ¶
func (s SecurityAPI) CreateOrReplaceGroup( ctx context.Context, req artgen.CreateOrReplaceGroupRequestObject, ) (artgen.CreateOrReplaceGroupResponseObject, error)
CreateOrReplaceGroup creates the group or replaces its fields. It answers 201 either way, which the artifactory_group resource requires.
func (SecurityAPI) CreateOrReplacePermissionTarget ¶
func (s SecurityAPI) CreateOrReplacePermissionTarget( ctx context.Context, req artgen.CreateOrReplacePermissionTargetRequestObject, ) (artgen.CreateOrReplacePermissionTargetResponseObject, error)
CreateOrReplacePermissionTarget creates the permission or replaces its repository section; build and release bundle sections set through v2 or Access stay.
func (SecurityAPI) CreateOrReplacePermissionTargetV2 ¶
func (s SecurityAPI) CreateOrReplacePermissionTargetV2( ctx context.Context, req artgen.CreateOrReplacePermissionTargetV2RequestObject, ) (artgen.CreateOrReplacePermissionTargetV2ResponseObject, error)
CreateOrReplacePermissionTargetV2 creates the permission or replaces its v2 sections whole. Administrators may create; holders of MANAGE may replace the actions of one that exists, granting or revoking only the actions they hold and never MANAGE, and leaving their own entries and their groups' as they are (createorreplacepermissiontargetv2.json, decision 0006).
func (SecurityAPI) CreateOrReplaceUser ¶
func (s SecurityAPI) CreateOrReplaceUser( ctx context.Context, req artgen.CreateOrReplaceUserRequestObject, ) (artgen.CreateOrReplaceUserResponseObject, error)
CreateOrReplaceUser creates the user or replaces its fields. It answers 201 either way, which the artifactory_user resource relies on.
func (SecurityAPI) CreatePermissionTargetV2 ¶
func (s SecurityAPI) CreatePermissionTargetV2( ctx context.Context, req artgen.CreatePermissionTargetV2RequestObject, ) (artgen.CreatePermissionTargetV2ResponseObject, error)
CreatePermissionTargetV2 creates the permission; 409 when the name is taken, which jfrog-client-go reads as "already exists".
func (SecurityAPI) DeactivateArtifactoryKeyEncryption ¶
func (s SecurityAPI) DeactivateArtifactoryKeyEncryption( ctx context.Context, _ artgen.DeactivateArtifactoryKeyEncryptionRequestObject, ) (artgen.DeactivateArtifactoryKeyEncryptionResponseObject, error)
DeactivateArtifactoryKeyEncryption answers an administrator DONE and changes nothing, so secrets stay sealed (decision 0017). 7.x's decrypt answers 409 "Cannot decrypt without artifactory key file" only before any key exists and 405 only on SaaS; a server whose secrets are always sealed is never in the first state, and artifactweave is self-managed. 7.x's own decrypted state lasts only until the next configuration change (the reference page), so a client cannot rely on it either.
func (SecurityAPI) DeleteCertificate ¶
func (s SecurityAPI) DeleteCertificate( ctx context.Context, req artgen.DeleteCertificateRequestObject, ) (artgen.DeleteCertificateResponseObject, error)
DeleteCertificate removes a certificate no remote repository presents.
func (SecurityAPI) DeleteGroup ¶
func (s SecurityAPI) DeleteGroup( ctx context.Context, req artgen.DeleteGroupRequestObject, ) (artgen.DeleteGroupResponseObject, error)
DeleteGroup removes the group and its memberships.
func (SecurityAPI) DeleteKeyPair ¶
func (s SecurityAPI) DeleteKeyPair( ctx context.Context, req artgen.DeleteKeyPairRequestObject, ) (artgen.DeleteKeyPairResponseObject, error)
DeleteKeyPair removes a pair, in use or not: 7.x documents no refusal (deletekeypair answers 200, 401, 403, 404 and 500 alone), and the Terraform provider may destroy a pair before the repositories that name it. Those repositories lose their reference in the same transaction. Left behind, it would name a pair that does not exist, which every later update of the repository would then be refused for (repos.CheckKeypairs).
func (SecurityAPI) DeletePermissionTarget ¶
func (s SecurityAPI) DeletePermissionTarget( ctx context.Context, req artgen.DeletePermissionTargetRequestObject, ) (artgen.DeletePermissionTargetResponseObject, error)
DeletePermissionTarget removes the whole permission.
func (SecurityAPI) DeletePermissionTargetV2 ¶
func (s SecurityAPI) DeletePermissionTargetV2( ctx context.Context, req artgen.DeletePermissionTargetV2RequestObject, ) (artgen.DeletePermissionTargetV2ResponseObject, error)
DeletePermissionTargetV2 removes the permission. Unlike a read or a replace, it needs an administrator (deletepermissiontargetv2.json) or a Manage Resources holder.
func (SecurityAPI) DeleteUser ¶
func (s SecurityAPI) DeleteUser( ctx context.Context, req artgen.DeleteUserRequestObject, ) (artgen.DeleteUserResponseObject, error)
DeleteUser removes the user, its memberships and its tokens.
func (SecurityAPI) ExpirePasswordForAllUsers ¶
func (s SecurityAPI) ExpirePasswordForAllUsers( ctx context.Context, _ artgen.ExpirePasswordForAllUsersRequestObject, ) (artgen.ExpirePasswordForAllUsersResponseObject, error)
ExpirePasswordForAllUsers expires every internal password, the caller's included.
func (SecurityAPI) ExpirePasswordForMultipleUsers ¶
func (s SecurityAPI) ExpirePasswordForMultipleUsers( ctx context.Context, req artgen.ExpirePasswordForMultipleUsersRequestObject, ) (artgen.ExpirePasswordForMultipleUsersResponseObject, error)
ExpirePasswordForMultipleUsers forces the named users to change their passwords; unknown names are reported, not refused.
func (SecurityAPI) ExpirePasswordForSingleUser ¶
func (s SecurityAPI) ExpirePasswordForSingleUser( ctx context.Context, req artgen.ExpirePasswordForSingleUserRequestObject, ) (artgen.ExpirePasswordForSingleUserResponseObject, error)
ExpirePasswordForSingleUser is the deprecated path form of the expiry, for one user; an unknown user is 404, as the unexpire form answers.
func (SecurityAPI) GetAPIRestriction ¶
func (s SecurityAPI) GetAPIRestriction( ctx context.Context, req artgen.GetAPIRestrictionRequestObject, ) (artgen.GetAPIRestrictionResponseObject, error)
GetAPIRestriction returns a user's temporary API restriction to an administrator, an inactive one when none was ever set (GET /artifactory/api/artifactweave/api-restrictions/{userName}).
func (SecurityAPI) GetAPIRestrictionAudit ¶
func (s SecurityAPI) GetAPIRestrictionAudit( ctx context.Context, req artgen.GetAPIRestrictionAuditRequestObject, ) (artgen.GetAPIRestrictionAuditResponseObject, error)
GetAPIRestrictionAudit lists the changes to temporary API restrictions, newest first and a page at a time, for an administrator (GET /artifactory/api/artifactweave/api-restriction-audit).
func (SecurityAPI) GetAllKeyPairs ¶
func (s SecurityAPI) GetAllKeyPairs( ctx context.Context, _ artgen.GetAllKeyPairsRequestObject, ) (artgen.GetAllKeyPairsResponseObject, error)
GetAllKeyPairs lists every key pair without private material.
func (SecurityAPI) GetApiKey ¶
func (s SecurityAPI) GetApiKey( ctx context.Context, _ artgen.GetApiKeyRequestObject, ) (artgen.GetApiKeyResponseObject, error)
GetApiKey answers 404, the documented answer when no key exists; the JFrog CLI reads it as "no key".
func (SecurityAPI) GetCertificates ¶
func (s SecurityAPI) GetCertificates( ctx context.Context, _ artgen.GetCertificatesRequestObject, ) (artgen.GetCertificatesResponseObject, error)
GetCertificates lists the client certificates remote repositories may present to upstreams.
func (SecurityAPI) GetGroupDetails ¶
func (s SecurityAPI) GetGroupDetails( ctx context.Context, req artgen.GetGroupDetailsRequestObject, ) (artgen.GetGroupDetailsResponseObject, error)
GetGroupDetails returns the legacy group document; members only with includeUsers=true.
func (SecurityAPI) GetGroups ¶
func (s SecurityAPI) GetGroups( ctx context.Context, _ artgen.GetGroupsRequestObject, ) (artgen.GetGroupsResponseObject, error)
GetGroups lists groups with their detail URLs, written as the store's pages are read.
func (SecurityAPI) GetKeyPair ¶
func (s SecurityAPI) GetKeyPair( ctx context.Context, req artgen.GetKeyPairRequestObject, ) (artgen.GetKeyPairResponseObject, error)
GetKeyPair returns one pair's readable projection, which the Terraform provider reads after every create. Any caller the middleware lets through may read it, as 7.x lets any authenticated user, and anonymous while anonymous access is on (getkeypair). That is safe only because the projection carries the public half alone: keypairSummary must never gain the private key or the passphrase.
func (SecurityAPI) GetKeyPairPublicKeyPerRepository ¶
func (s SecurityAPI) GetKeyPairPublicKeyPerRepository( ctx context.Context, req artgen.GetKeyPairPublicKeyPerRepositoryRequestObject, ) (artgen.GetKeyPairPublicKeyPerRepositoryResponseObject, error)
GetKeyPairPublicKeyPerRepository returns the public half of the repository's signing pair, including Alpine, Debian and RPM virtual repositories' keyPair, which clients fetch to verify signed metadata. 7.x asks only for an authenticated user, or anonymous while anonymous access is on (getkeypairpublickeyperrepository), and no read permission on the repository, so a caller that may not read a repository still learns whether it exists and which key signs it.
func (SecurityAPI) GetLegacyTokens ¶
func (s SecurityAPI) GetLegacyTokens( ctx context.Context, _ artgen.GetLegacyTokensRequestObject, ) (artgen.GetLegacyTokensResponseObject, error)
GetLegacyTokens lists every token in the legacy shape. Unlike GET /access/api/v1/tokens, which shows a user their own, it is admin only, as the deprecated legacy API documents (#382).
func (SecurityAPI) GetLockedOutUsers ¶
func (s SecurityAPI) GetLockedOutUsers( ctx context.Context, _ artgen.GetLockedOutUsersRequestObject, ) (artgen.GetLockedOutUsersResponseObject, error)
GetLockedOutUsers lists the users the lock policy locked, written as the store's pages are read.
func (SecurityAPI) GetPasswordExpirationPolicy ¶
func (s SecurityAPI) GetPasswordExpirationPolicy( ctx context.Context, _ artgen.GetPasswordExpirationPolicyRequestObject, ) (artgen.GetPasswordExpirationPolicyResponseObject, error)
GetPasswordExpirationPolicy returns the password expiry settings.
func (SecurityAPI) GetPermissionTargetDetails ¶
func (s SecurityAPI) GetPermissionTargetDetails( ctx context.Context, req artgen.GetPermissionTargetDetailsRequestObject, ) (artgen.GetPermissionTargetDetailsResponseObject, error)
GetPermissionTargetDetails returns the v1 view: the repository section with action letters.
func (SecurityAPI) GetPermissionTargetDetailsV2 ¶
func (s SecurityAPI) GetPermissionTargetDetailsV2( ctx context.Context, req artgen.GetPermissionTargetDetailsV2RequestObject, ) (artgen.GetPermissionTargetDetailsV2ResponseObject, error)
GetPermissionTargetDetailsV2 returns every v2 section.
func (SecurityAPI) GetPermissionTargets ¶
func (s SecurityAPI) GetPermissionTargets( ctx context.Context, _ artgen.GetPermissionTargetsRequestObject, ) (artgen.GetPermissionTargetsResponseObject, error)
GetPermissionTargets lists every permission with its v1 detail URL.
func (SecurityAPI) GetPermissionTargetsByGroupV2 ¶
func (s SecurityAPI) GetPermissionTargetsByGroupV2( ctx context.Context, req artgen.GetPermissionTargetsByGroupV2RequestObject, ) (artgen.GetPermissionTargetsByGroupV2ResponseObject, error)
GetPermissionTargetsByGroupV2 returns the permissions granting the group.
func (SecurityAPI) GetPermissionTargetsByUserV2 ¶
func (s SecurityAPI) GetPermissionTargetsByUserV2( ctx context.Context, req artgen.GetPermissionTargetsByUserV2RequestObject, ) (artgen.GetPermissionTargetsByUserV2ResponseObject, error)
GetPermissionTargetsByUserV2 returns the permissions granting the user directly; grants through its groups are not expanded.
func (SecurityAPI) GetPermissionTargetsV2 ¶
func (s SecurityAPI) GetPermissionTargetsV2( ctx context.Context, _ artgen.GetPermissionTargetsV2RequestObject, ) (artgen.GetPermissionTargetsV2ResponseObject, error)
GetPermissionTargetsV2 lists what the caller may manage: every permission for an administrator or a Manage Resources holder, otherwise those it holds MANAGE on.
func (SecurityAPI) GetUserDetails ¶
func (s SecurityAPI) GetUserDetails( ctx context.Context, req artgen.GetUserDetailsRequestObject, ) (artgen.GetUserDetailsResponseObject, error)
GetUserDetails returns the legacy user document, without the password.
func (SecurityAPI) GetUserEncryptedPassword ¶
func (s SecurityAPI) GetUserEncryptedPassword( ctx context.Context, _ artgen.GetUserEncryptedPasswordRequestObject, ) (artgen.GetUserEncryptedPasswordResponseObject, error)
GetUserEncryptedPassword returns, in place of Artifactory's encrypted password, a reference token bound to the caller: every client that took the encrypted password accepts it as a password. Like the encrypted password it is the same on every call and lasts until the password is set or expired, which revokes it; it is also revocable through the token API. A token-authenticated caller is refused: the encrypted password stands for a password, which only a password login proves.
func (SecurityAPI) GetUserLockPolicy ¶
func (s SecurityAPI) GetUserLockPolicy( ctx context.Context, _ artgen.GetUserLockPolicyRequestObject, ) (artgen.GetUserLockPolicyResponseObject, error)
GetUserLockPolicy returns the lockout settings.
func (SecurityAPI) GetUsers ¶
func (s SecurityAPI) GetUsers( ctx context.Context, _ artgen.GetUsersRequestObject, ) (artgen.GetUsersResponseObject, error)
GetUsers lists users with their detail URLs, written as the store's pages are read.
func (SecurityAPI) PermissionTargetExistenceCheckV2 ¶
func (s SecurityAPI) PermissionTargetExistenceCheckV2( ctx context.Context, req artgen.PermissionTargetExistenceCheckV2RequestObject, ) (artgen.PermissionTargetExistenceCheckV2ResponseObject, error)
PermissionTargetExistenceCheckV2 answers 200 or 404 with no body.
func (SecurityAPI) RegenerateApiKey ¶
func (s SecurityAPI) RegenerateApiKey( ctx context.Context, _ artgen.RegenerateApiKeyRequestObject, ) (artgen.RegenerateApiKeyResponseObject, error)
RegenerateApiKey refuses: no user holds a key to rotate.
func (SecurityAPI) RevokeApiKey ¶
func (s SecurityAPI) RevokeApiKey( ctx context.Context, req artgen.RevokeApiKeyRequestObject, ) (artgen.RevokeApiKeyResponseObject, error)
RevokeApiKey answers 200 with nothing revoked, for scripts that revoke unconditionally. deleteAll=1 needs an administrator.
func (SecurityAPI) RevokeUserApiKey ¶
func (s SecurityAPI) RevokeUserApiKey( ctx context.Context, req artgen.RevokeUserApiKeyRequestObject, ) (artgen.RevokeUserApiKeyResponseObject, error)
RevokeUserApiKey answers 200 for an existing user and 404 otherwise; there is never a key to remove.
func (SecurityAPI) SetAPIRestriction ¶
func (s SecurityAPI) SetAPIRestriction( ctx context.Context, req artgen.SetAPIRestrictionRequestObject, ) (artgen.SetAPIRestrictionResponseObject, error)
SetAPIRestriction restricts a user's API access, for a reason and until a time at most seven days ahead, for an administrator (PUT /artifactory/api/artifactweave/api-restrictions/{userName}).
func (SecurityAPI) SetPasswordExpirationPolicy ¶
func (s SecurityAPI) SetPasswordExpirationPolicy( ctx context.Context, req artgen.SetPasswordExpirationPolicyRequestObject, ) (artgen.SetPasswordExpirationPolicyResponseObject, error)
SetPasswordExpirationPolicy replaces the policy: omitted fields take their defaults, not their previous values, as in Artifactory.
func (SecurityAPI) UnexpirePasswordForSingleUser ¶
func (s SecurityAPI) UnexpirePasswordForSingleUser( ctx context.Context, req artgen.UnexpirePasswordForSingleUserRequestObject, ) (artgen.UnexpirePasswordForSingleUserResponseObject, error)
UnexpirePasswordForSingleUser clears a forced password change.
func (SecurityAPI) UnlockAllLockedOutUsers ¶
func (s SecurityAPI) UnlockAllLockedOutUsers( ctx context.Context, _ artgen.UnlockAllLockedOutUsersRequestObject, ) (artgen.UnlockAllLockedOutUsersResponseObject, error)
UnlockAllLockedOutUsers clears every lock.
func (SecurityAPI) UnlockLockedOutUser ¶
func (s SecurityAPI) UnlockLockedOutUser( ctx context.Context, req artgen.UnlockLockedOutUserRequestObject, ) (artgen.UnlockLockedOutUserResponseObject, error)
UnlockLockedOutUser is the path form the JFrog CLI sends for one user.
func (SecurityAPI) UnlockLockedOutUsers ¶
func (s SecurityAPI) UnlockLockedOutUsers( ctx context.Context, req artgen.UnlockLockedOutUsersRequestObject, ) (artgen.UnlockLockedOutUsersResponseObject, error)
UnlockLockedOutUsers clears the named users' locks.
func (SecurityAPI) UpdateGroup ¶
func (s SecurityAPI) UpdateGroup( ctx context.Context, req artgen.UpdateGroupRequestObject, ) (artgen.UpdateGroupResponseObject, error)
UpdateGroup changes the fields the body carries.
func (SecurityAPI) UpdateKeyPair ¶
func (s SecurityAPI) UpdateKeyPair( ctx context.Context, req artgen.UpdateKeyPairRequestObject, ) (artgen.UpdateKeyPairResponseObject, error)
UpdateKeyPair replaces the pair named in the body; repositories that reference it sign with the new material from the next request.
func (SecurityAPI) UpdateUser ¶
func (s SecurityAPI) UpdateUser( ctx context.Context, req artgen.UpdateUserRequestObject, ) (artgen.UpdateUserResponseObject, error)
UpdateUser changes the fields the body carries.
func (SecurityAPI) VerifyKeyPair ¶
func (s SecurityAPI) VerifyKeyPair( ctx context.Context, req artgen.VerifyKeyPairRequestObject, ) (artgen.VerifyKeyPairResponseObject, error)
VerifyKeyPair checks a pair without storing it.
type Server ¶
type Server struct {
Access *AccessService
Security *SecurityAPI
}
Server holds the access module's two partial strict servers over one shared state: the composition root embeds Access in the access spec's strict server and Security in the artifactory spec's.
func New ¶
New returns the access partials over d. Without d.IDTokens it builds one verifier, which both partials share, so the providers' keys stay cached between exchanges for the life of the handler.
func (*Server) CheckAPIRestriction ¶
func (s *Server) CheckAPIRestriction( health func(*http.Request) bool, limitErr func(http.ResponseWriter, *http.Request, error), ) func(http.Handler) http.Handler
CheckAPIRestriction returns the middleware that refuses an authenticated user's request while that user's API restriction is in force. It runs after authentication, which names the user, and needs a store. The router supplies health, the probes that every caller may make, and limitErr, which answers a restriction read that failed or timed out as the request limiter answers; recovery requests (APIRecoveryRequest) always pass.
This also covers embedders with a custom Authenticator. The application supplies the policy to Authenticator as well, for native self-authentication and subsequent Current credential checks.
func (*Server) RegisterRoutes ¶
RegisterRoutes mounts the legacy token API's create and revoke (legacyTokenPath and legacyTokenRevokePath), whose form-encoded bodies the generated server cannot bind. The caller bounds their bodies, as it bounds the generated routes' bodies.
type Store ¶
type Store interface {
port.Store
// Settings holds the security policies, the basic authentication
// switch and the other access settings the handlers serve.
Settings() settings.SettingsStore
// Configs holds the OIDC providers and identity mappings.
Configs() configdoc.ConfigStore
}
Store is what the access handlers read and write: the access ports, the settings and OIDC configuration documents they serve, and the transaction a key pair delete runs in. The application passes its composite store, and every call joins the transaction ctx carries. The adapter declares its own rather than taking the module root's access.Store, because a module package never imports a module root, and because the handlers also serve the OIDC configuration documents, which no binding reads.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package login will serve browser login and the native-client approval endpoints.
|
Package login will serve browser login and the native-client approval endpoints. |
|
Package scim will serve the SCIM endpoints: discovery, users, groups, filters, pagination and PATCH.
|
Package scim will serve the SCIM endpoints: discovery, users, groups, filters, pagination and PATCH. |