authentication.setPrivateKey( server.getPrivateKey() ); authentication.setPassphrase( server.getPassphrase() );
private Authentication getAuthentication( RepositorySystemSession session, ArtifactRepository repository ) { if ( session != null ) { AuthenticationSelector selector = session.getAuthenticationSelector(); if ( selector != null ) { RemoteRepository repo = RepositoryUtils.toRepo( repository ); org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo ); if ( auth != null ) { repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build(); AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo ); Authentication result = new Authentication( authCtx.get( AuthenticationContext.USERNAME ), authCtx.get( AuthenticationContext.PASSWORD ) ); result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) ); result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) ); authCtx.close(); return result; } } } return null; }
private Authentication getAuthentication( RepositorySystemSession session, ArtifactRepository repository ) { if ( session != null ) { AuthenticationSelector selector = session.getAuthenticationSelector(); if ( selector != null ) { RemoteRepository repo = RepositoryUtils.toRepo( repository ); org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo ); if ( auth != null ) { repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build(); AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo ); Authentication result = new Authentication( authCtx.get( AuthenticationContext.USERNAME ), authCtx.get( AuthenticationContext.PASSWORD ) ); result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) ); result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) ); authCtx.close(); return result; } } } return null; }
private Authentication createServerAuthentication(Server server) { Authentication authentication = new Authentication(server.getUsername(), server.getPassword()); authentication.setPrivateKey(server.getPrivateKey()); authentication.setPassphrase(server.getPassphrase()); return authentication; } }
private Authentication createServerAuthentication(Server server) { Authentication authentication = new Authentication(server.getUsername(), server.getPassword()); authentication.setPrivateKey(server.getPrivateKey()); authentication.setPassphrase(server.getPassphrase()); return authentication; } }
private org.apache.maven.artifact.repository.Authentication authentication( MavenSettings settings, RepositorySystemSession session, RemoteRepository remote, Authentication authentication) { AuthenticationContext context = AuthenticationContext.forRepository(session, remote); if (context == null) { return null; } authentication.fill(context, "username", Collections.<String, String>emptyMap()); authentication.fill(context, "password", Collections.<String, String>emptyMap()); authentication.fill(context, "passphrase", Collections.<String, String>emptyMap()); authentication.fill(context, "privateKey", Collections.<String, String>emptyMap()); org.apache.maven.artifact.repository.Authentication maven = new org.apache.maven.artifact.repository.Authentication( context.get("username"), context.get("password")); if (context.get("passphrase") != null) { maven.setPassphrase(context.get("passphrase")); } if (context.get("privateKey") != null) { maven.setPrivateKey(context.get("privateKey")); } return maven; }