Package land.oras.auth
Class RegistriesConf
java.lang.Object
land.oras.auth.RegistriesConf
Handle registries.conf configuration
-
Method Summary
Modifier and TypeMethodDescriptionvoidEnforce the short name mode by checking the configuration.Return the aliasesgetAliasKey(ContainerRef ref) Return the key of the aliasGet the list of unqualified registries.booleanCheck if the given alias exists in the configuration.booleanisBlocked(ContainerRef location) Check if the given registry is marked as blocked in the configuration.booleanisInsecure(ContainerRef location) Check if the given registry is marked as insecure in the configuration.static RegistriesConfnewConf()Create a new RegistriesConf instance by loading configuration from standard paths.static RegistriesConfCreate a new RegistriesConf instance by loading configuration from the specified paths.rewrite(ContainerRef ref) Rewrite the given container reference according to the matching registry configuration.
-
Method Details
-
newConf
Create a new RegistriesConf instance by loading configuration from the specified paths.- Parameters:
configPaths- The list of paths to load configuration from.- Returns:
- A new RegistriesConf instance.
-
newConf
Create a new RegistriesConf instance by loading configuration from standard paths.- Returns:
- A new RegistriesConf instance.
-
getUnqualifiedRegistries
Get the list of unqualified registries.- Returns:
- an unmodifiable list of unqualified registries.
-
getAliasKey
Return the key of the alias- Parameters:
ref- the container reference to get the alias key for.- Returns:
- the alias key for the given container reference, which is either the repository name
-
enforceShortNameMode
Enforce the short name mode by checking the configuration. If the short name mode is set to ENFORCING or PERMISSIVE and there are multiple unqualified registries configured, this method throws an OrasException indicating that the configuration is invalid. If the configuration is valid, this method does nothing.- Throws:
OrasException- if the short name mode is set to ENFORCING or PERMISSIVE and there are multiple unqualified registries configured, indicating that the configuration is invalid.
-
getAliases
Return the aliases- Returns:
- an unmodifiable map of aliases, where the key is the alias and the value is the actual registry URL.
-
hasAlias
Check if the given alias exists in the configuration.- Parameters:
alias- the alias to check for existence.- Returns:
- true if the alias exists, false otherwise.
-
isBlocked
Check if the given registry is marked as blocked in the configuration.- Parameters:
location- the registry location to check for blocking.- Returns:
- true if the registry is marked as blocked, false otherwise.
-
isInsecure
Check if the given registry is marked as insecure in the configuration.- Parameters:
location- the registry location to check for insecurity.- Returns:
- true if the registry is marked as insecure, false otherwise.
-
rewrite
Rewrite the given container reference according to the matching registry configuration.- Parameters:
ref- the container reference to rewrite.- Returns:
- the rewritten container reference.
-