org.apache.maven.wagon.authentication.AuthenticationInfo Java Examples

The following examples show how to use org.apache.maven.wagon.authentication.AuthenticationInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteExistsMojo.java    From exists-maven-plugin with Apache License 2.0 6 votes vote down vote up
AuthenticationInfo getAuthInfo(String serverId) throws SecDispatcherException {
  Server server = settings.getServer(serverId);
  if (server == null) {
    return null;
  }

  /* begin https://github.com/chonton/exists-maven-plugin/issues/22 */
  if (securityDispatcher instanceof DefaultSecDispatcher) {
    ((DefaultSecDispatcher) securityDispatcher)
        .setConfigurationFile("~/.m2/settings-security.xml");
  }
  /* end https://github.com/chonton/exists-maven-plugin/issues/22 */

  AuthenticationInfo authInfo = new AuthenticationInfo();
  authInfo.setUserName(server.getUsername());
  authInfo.setPassword(securityDispatcher.decrypt(server.getPassword()));
  authInfo.setPassphrase(server.getPassphrase());
  authInfo.setPrivateKey(server.getPrivateKey());
  return authInfo;
}
 
Example #2
Source File: NexusRepositoryIndexerImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private WagonHelper.WagonFetcher createFetcher(final Wagon wagon, TransferListener listener, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo) {
    if(isDiag()) {
        return new WagonHelper.WagonFetcher(wagon, listener, authenticationInfo, proxyInfo) {
            @Override
            public InputStream retrieve(String name) throws IOException, FileNotFoundException {
                String id = wagon.getRepository().getId();
                if(name.contains("properties") && System.getProperty("maven.diag.index.properties." + id) != null) { // NOI18N
                    LOGGER.log(Level.INFO, "maven indexer will use local properties file: {0}", System.getProperty("maven.diag.index.properties." + id)); // NOI18N
                    return new FileInputStream(new File(System.getProperty("maven.diag.index.properties." + id))); // NOI18N
                } else if(name.contains(".gz") && System.getProperty("maven.diag.index.gz." + id) != null) { // NOI18N
                    LOGGER.log(Level.INFO, "maven indexer will use gz file: {0}", System.getProperty("maven.diag.index.gz." + id)); // NOI18N
                    return new FileInputStream(new File(System.getProperty("maven.diag.index.gz." + id))); // NOI18N
                }
                return super.retrieve(name);
            }
        };
    } else {
        return new WagonHelper.WagonFetcher(wagon, listener, authenticationInfo, proxyInfo);
    }
}
 
Example #3
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectRepositoryProxyInfo() throws ConnectionException, AuthenticationException {
    this.wagon.connect(this.repository, this.proxyInfo);

    assertEquals(this.repository, this.wagon.getRepository());
    verify(this.sessionListenerSupport).fireSessionOpening();
    verify(this.wagon).connectToRepository(eq(this.repository), (AuthenticationInfo) isNull(),
            any(NullProtectingProxyInfoProvider.class));
    verify(this.sessionListenerSupport).fireSessionLoggedIn();
    verify(this.sessionListenerSupport).fireSessionOpened();
}
 
Example #4
Source File: MockWagon.java    From archiva with Apache License 2.0 5 votes vote down vote up
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo,
                     ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{

}
 
Example #5
Source File: AbstractWagon.java    From lambadaframework with MIT License 5 votes vote down vote up
@Override
public final void connect(Repository source, AuthenticationInfo authenticationInfo,
                          ProxyInfoProvider proxyInfoProvider) throws ConnectionException, AuthenticationException {
    this.repository = source;
    this.sessionListenerSupport.fireSessionOpening();
    try {
        connectToRepository(source, authenticationInfo, proxyInfoProvider);
        this.sessionListenerSupport.fireSessionLoggedIn();
        this.sessionListenerSupport.fireSessionOpened();
    } catch (ConnectionException | AuthenticationException e) {
        this.sessionListenerSupport.fireSessionConnectionRefused();
        throw e;
    }
}
 
Example #6
Source File: AuthenticationInfoAWSCredentialsProviderChain.java    From lambadaframework with MIT License 5 votes vote down vote up
AuthenticationInfoAWSCredentialsProviderChain(AuthenticationInfo authenticationInfo) {
    super(
            new InstanceProfileCredentialsProvider(),
            new ProfileCredentialsProvider(),
            new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            new InstanceProfileCredentialsProvider());
}
 
Example #7
Source File: SimpleStorageServiceWagon.java    From lambadaframework with MIT License 5 votes vote down vote up
@Override
protected void connectToRepository(Repository repository, AuthenticationInfo authenticationInfo,
                                   ProxyInfoProvider proxyInfoProvider) throws AuthenticationException {
    if (this.amazonS3 == null) {

        ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(proxyInfoProvider);

        this.bucketName = S3Utils.getBucketName(repository);
        this.baseDirectory = S3Utils.getBaseDirectory(repository);

        this.amazonS3 = new AmazonS3Client(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
        Region region = Region.fromLocationConstraint(this.amazonS3.getBucketLocation(this.bucketName));
        this.amazonS3.setEndpoint(region.getEndpoint());
    }
}
 
Example #8
Source File: AbstractWagon.java    From lambadaframework with MIT License 4 votes vote down vote up
@Override
public final void connect(Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo)
        throws ConnectionException, AuthenticationException {
    connect(source, authenticationInfo, new NullProtectingProxyInfoProvider(proxyInfo));
}
 
Example #9
Source File: AbstractWagon.java    From lambadaframework with MIT License 4 votes vote down vote up
@Override
public final void connect(Repository source, AuthenticationInfo authenticationInfo) throws ConnectionException,
        AuthenticationException {
    connect(source, authenticationInfo, (ProxyInfoProvider) null);
}
 
Example #10
Source File: AbstractWagon.java    From lambadaframework with MIT License 4 votes vote down vote up
protected abstract void connectToRepository(Repository repository, AuthenticationInfo authenticationInfo,
                                    ProxyInfoProvider proxyInfoProvider) throws ConnectionException,
AuthenticationException;
 
Example #11
Source File: AuthenticationInfoAWSCredentialsProvider.java    From lambadaframework with MIT License 4 votes vote down vote up
AuthenticationInfoAWSCredentialsProvider(AuthenticationInfo authenticationInfo) {
    this.authenticationInfo = authenticationInfo;
}
 
Example #12
Source File: AuthenticationInfoAWSCredentials.java    From lambadaframework with MIT License 4 votes vote down vote up
AuthenticationInfoAWSCredentials(AuthenticationInfo authenticationInfo) {
    this.authenticationInfo = authenticationInfo;
}
 
Example #13
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 4 votes vote down vote up
@Override
protected void connectToRepository(Repository source, AuthenticationInfo authenticationInfo,
                                   ProxyInfoProvider proxyInfo) throws ConnectionException,
        AuthenticationException {
}
 
Example #14
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository source, AuthenticationInfo authenticationInfo )
    throws ConnectionException, AuthenticationException
{
    delegate.connect( source, authenticationInfo );
}
 
Example #15
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
    throws ConnectionException, AuthenticationException
{
    delegate.connect( source, authenticationInfo, proxyInfo );
}
 
Example #16
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{
    delegate.connect( source, authenticationInfo, proxyInfoProvider );
}
 
Example #17
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo )
    throws ConnectionException, AuthenticationException
{

}
 
Example #18
Source File: MockWagon.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
    throws ConnectionException, AuthenticationException
{

}