本文整理了Java中org.apache.maven.artifact.repository.Authentication.<init>()
方法的一些代码示例,展示了Authentication.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authentication.<init>()
方法的具体详情如下:
包路径:org.apache.maven.artifact.repository.Authentication
类名称:Authentication
方法名:<init>
暂无
代码示例来源:origin: apache/maven
Authentication authentication = new Authentication( server.getUsername(), server.getPassword() );
authentication.setPrivateKey( server.getPrivateKey() );
authentication.setPassphrase( server.getPassphrase() );
代码示例来源:origin: apache/maven
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;
}
代码示例来源:origin: apache/maven
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;
}
代码示例来源:origin: com.itemis.maven.plugins/unleash-maven-plugin
private Authentication createServerAuthentication(Server server) {
Authentication authentication = new Authentication(server.getUsername(), server.getPassword());
authentication.setPrivateKey(server.getPrivateKey());
authentication.setPassphrase(server.getPassphrase());
return authentication;
}
}
代码示例来源:origin: shillner/unleash-maven-plugin
private Authentication createServerAuthentication(Server server) {
Authentication authentication = new Authentication(server.getUsername(), server.getPassword());
authentication.setPrivateKey(server.getPrivateKey());
authentication.setPassphrase(server.getPassphrase());
return authentication;
}
}
代码示例来源:origin: org.springframework.boot.experimental/spring-boot-thin-launcher
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;
}
代码示例来源:origin: org.uberfire/uberfire-maven-integration
private ArtifactRepository toArtifactRepository( RemoteRepository remoteRepository ) {
final String id = remoteRepository.getId();
final String url = remoteRepository.getUrl();
final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
ArtifactRepositoryPolicy snapshots = new ArtifactRepositoryPolicy();
ArtifactRepositoryPolicy releases = new ArtifactRepositoryPolicy();
if ( remoteRepository.getPolicy( true ) != null ) {
snapshots = new ArtifactRepositoryPolicy( remoteRepository.getPolicy( true ).isEnabled(),
remoteRepository.getPolicy( true ).getUpdatePolicy(),
remoteRepository.getPolicy( true ).getChecksumPolicy() );
}
if ( remoteRepository.getPolicy( false ) != null ) {
releases = new ArtifactRepositoryPolicy( remoteRepository.getPolicy( false ).isEnabled(),
remoteRepository.getPolicy( false ).getUpdatePolicy(),
remoteRepository.getPolicy( false ).getChecksumPolicy() );
}
final ArtifactRepository artifactRepository = new MavenArtifactRepository( id,
url,
layout,
snapshots,
releases );
final Server server = settings.getServer( id );
if ( server != null ) {
artifactRepository.setAuthentication( new Authentication( server.getUsername(),
server.getPassword() ) );
}
return artifactRepository;
}
}
代码示例来源:origin: org.kie.soup/kie-soup-maven-integration
private ArtifactRepository toArtifactRepository( RemoteRepository remoteRepository ) {
final String id = remoteRepository.getId();
final String url = remoteRepository.getUrl();
final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
ArtifactRepositoryPolicy snapshots = new ArtifactRepositoryPolicy();
ArtifactRepositoryPolicy releases = new ArtifactRepositoryPolicy();
if ( remoteRepository.getPolicy( true ) != null ) {
snapshots = new ArtifactRepositoryPolicy( remoteRepository.getPolicy( true ).isEnabled(),
remoteRepository.getPolicy( true ).getUpdatePolicy(),
remoteRepository.getPolicy( true ).getChecksumPolicy() );
}
if ( remoteRepository.getPolicy( false ) != null ) {
releases = new ArtifactRepositoryPolicy( remoteRepository.getPolicy( false ).isEnabled(),
remoteRepository.getPolicy( false ).getUpdatePolicy(),
remoteRepository.getPolicy( false ).getChecksumPolicy() );
}
final ArtifactRepository artifactRepository = new MavenArtifactRepository( id,
url,
layout,
snapshots,
releases );
final Server server = settings.getServer( id );
if ( server != null ) {
artifactRepository.setAuthentication( new Authentication( server.getUsername(),
server.getPassword() ) );
}
return artifactRepository;
}
}
内容来源于网络,如有侵权,请联系作者删除!