Class RegistrySpec
- All Implemented Interfaces:
org.gradle.api.Named
registries { } container
exposed by KonfigyrExtension.
Every registry needs exactly one seed value, its url - the OAuth2 token endpoint
(and any other OAuth2 endpoint the plugin needs) is discovered from it at build time rather than
configured directly, and the Artifactory API is reached via fixed, plugin-internal relative paths
under that same origin.
Exactly one OAuth2 grant type must be configured, either client credentials:
registries {
registry("staging") {
url = uri("https://staging.konfigyr.io")
clientCredentials {
clientId = "acme-corp-client"
clientSecret = "acme-corp-secret"
}
}
}
or token exchange:
registries {
registry("staging") {
url = uri("https://staging.konfigyr.io")
tokenExchange {
clientId = "acme-corp-client"
subjectToken = "..."
subjectTokenType = "urn:ietf:params:oauth:token-type:jwt"
}
}
}
If both blocks are configured, tokenExchange takes priority, since it prefers the
shorter-lived, revocable mechanism. Neither grant falls back to environment variables for a
registry created via KonfigyrExtension.registry(String, Action). Every value must be set
explicitly. The reserved registry created via KonfigyrExtension.konfigyrCentral() is the
only exception, resolving unset values from the same KONFIGYR_CLIENT_ID /
KONFIGYR_CLIENT_SECRET / KONFIGYR_SUBJECT_TOKEN environment variables the plugin
has always supported.
The url must use https, unless the host is a loopback address. A
registry that's only ever reachable over an otherwise secured channel, for example a service
exposed exclusively on a private network or VPN, can opt out of this check with
insecure:
registries {
registry("internal") {
url = uri("http://konfigyr.internal.acme.com")
insecure = true
clientCredentials {
clientId = "acme-corp-client"
clientSecret = "acme-corp-secret"
}
}
}- Since:
- 1.2.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguresClientCredentials, used for the OAuth2client_credentialsgrant, as defined by RFC 6749, Section 4.4.static classConfigures aTokenExchange, used for the OAuth2 Token Exchange grant, as defined by RFC 8693.Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Constructor Summary
ConstructorsConstructorDescriptionRegistrySpec(String name, org.gradle.api.model.ObjectFactory objects, org.gradle.api.provider.ProviderFactory providers, boolean useEnvironmentConventions) Creates a newRegistrySpec, instantiated by Gradle for each entry added to theKonfigyrExtension.getRegistries()container. -
Method Summary
Modifier and TypeMethodDescriptionvoidclientCredentials(org.gradle.api.Action<RegistrySpec.ClientCredentialsSpec> action) ConfiguresClientCredentials, for the OAuth2client_credentialsgrant.org.gradle.api.provider.Property<Boolean> Whether this registry'surlis allowed to use the plainhttpscheme, beyond the loopback exemption that's always granted for local testing.getName()The name under which this registry is declared in theregistries { }container - either the reserved "konfigyrCentral" name, or a custom name passed toKonfigyrExtension.registry(String, Action).org.gradle.api.provider.Property<URI> getUrl()The registry'surl.voidtokenExchange(org.gradle.api.Action<RegistrySpec.TokenExchangeSpec> action) Configures aTokenExchange, for the OAuth2 Token Exchange grant.
-
Constructor Details
-
RegistrySpec
@Inject public RegistrySpec(String name, org.gradle.api.model.ObjectFactory objects, org.gradle.api.provider.ProviderFactory providers, boolean useEnvironmentConventions) Creates a newRegistrySpec, instantiated by Gradle for each entry added to theKonfigyrExtension.getRegistries()container.- Parameters:
name- the registry name, cannot be null.objects- the Gradle object factory, cannot be null.providers- the Gradle provider factory, used to resolve environment variable conventions, cannot be null.useEnvironmentConventions- true only for the reserved "konfigyrCentral" registry, enabling its environment variable fallbacks.
-
-
Method Details
-
clientCredentials
ConfiguresClientCredentials, for the OAuth2client_credentialsgrant.- Parameters:
action- configures the client credentials, cannot be null.
-
tokenExchange
Configures aTokenExchange, for the OAuth2 Token Exchange grant.- Parameters:
action- configures the token exchange, cannot be null.
-
getName
The name under which this registry is declared in theregistries { }container - either the reserved "konfigyrCentral" name, or a custom name passed toKonfigyrExtension.registry(String, Action). Also used to derive this registry's per-registry Gradle task names (e.g.publishArtifactMetadataToStaging).- Specified by:
getNamein interfaceorg.gradle.api.Named
-
getUrl
The registry'surl. This is the sole discovery seed for this registry: its OAuth2 endpoints are resolved from it at build time, and the Artifactory API is reached via fixed relative paths under this same origin. Must usehttps, unless the host is a loopback address, orinsecureis set to true. -
getInsecure
Whether this registry'surlis allowed to use the plainhttpscheme, beyond the loopback exemption that's always granted for local testing. Defaults to false.Use with caution: enabling this sends credentials in plaintext, so only set it for a registry that's known to be reachable exclusively over an otherwise secured channel, for example a service that's only accessible over a private network or VPN.
-