Class AuthenticationService


  • public class AuthenticationService
    extends Object

    Service used to authenticate to configured registries and verify authentication for the configured registries.

    Note that this service does not check if the credentials are (still) valid for authenticated registries. It only validates if credentials are present for registries and uses them to authenticate registries that are not yet in Podman's authentication file.

    • Constructor Detail

      • AuthenticationService

        public AuthenticationService​(org.apache.maven.plugin.logging.Log log,
                                     PodmanExecutorService podmanExecutorService,
                                     org.apache.maven.settings.Settings mavenSetings,
                                     org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter)
        Constructs a new instance of this service
        Parameters:
        log - Provides access to Maven's log system
        podmanExecutorService - Service for executing commands with Podman
        mavenSetings - Provides access to the Maven Settings
        settingsDecrypter - Provides access to Maven's SettingsDecrypter service from Maven core
    • Method Detail

      • authenticate

        public void authenticate​(String[] registries)
                          throws org.apache.maven.plugin.MojoExecutionException

        Ensures that credentials are available for the registries that are configured for this plugin, by executing a series of checks in a particular order.

        This method assumes authentication has taken place when the configured registries are also present in Podman's authentication file.

        When there are registries configured that are not present in Podman's default authentication file, this method will attempt authentication for those registries.

        This method will throw a MojoExecutionException in case:

        • No registries are passed (it means authentication is not skipped)
        • Authentication fails
        • Credentials for a certain registry could not be found in the Maven settings.
        Parameters:
        registries - The registries to authenticate to
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case authentication fails, no registries were passed or credentials are missing.