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

The following examples show how to use org.apache.maven.wagon.authentication.AuthenticationException. 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: 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 #2
Source File: WagonDelegate.java    From archiva with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings ("deprecation")
@Override
public void openConnection()
    throws ConnectionException, AuthenticationException
{
    delegate.openConnection();
}
 
Example #3
Source File: WagonUtils.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Convenience method to create a wagon.
 *
 * @param serverId The serverId to use if the wagonManager needs help.
 * @param url The url to create a wagon for.
 * @param wagonManager The wgaon manager to use.
 * @param settings The settings to use.
 * @param logger The logger to use.
 * @return The wagon to connect to the url.
 * @throws org.apache.maven.wagon.UnsupportedProtocolException if the protocol is not supported.
 * @throws org.apache.maven.artifact.manager.WagonConfigurationException if the wagon cannot be configured.
 * @throws org.apache.maven.wagon.ConnectionException If the connection cannot be established.
 * @throws org.apache.maven.wagon.authentication.AuthenticationException If the connection cannot be authenticated.
 */
public static Wagon createWagon( String serverId, String url, WagonManager wagonManager, Settings settings,
                                 Log logger )
                                     throws UnsupportedProtocolException, WagonConfigurationException,
                                     ConnectionException, AuthenticationException
{
    Repository repository = new Repository( serverId, url );
    Wagon wagon = wagonManager.getWagon( repository );

    if ( logger.isDebugEnabled() )
    {
        Debug debug = new Debug();
        wagon.addSessionListener( debug );
        wagon.addTransferListener( debug );
    }

    ProxyInfo proxyInfo = getProxyInfo( settings );
    if ( proxyInfo != null )
    {
        wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo );
    }
    else
    {
        wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) );
    }
    return wagon;
}
 
Example #4
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectAuthenticationException() throws ConnectionException, AuthenticationException {
    doThrow(new AuthenticationException("")).when(this.wagon).connectToRepository(this.repository,
            this.authenticationInfo, this.proxyInfoProvider);

    try {
        this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfoProvider);
        fail();
    } catch (AuthenticationException e) {
        assertEquals(this.repository, this.wagon.getRepository());
        verify(this.sessionListenerSupport).fireSessionOpening();
        verify(this.sessionListenerSupport).fireSessionConnectionRefused();
    }
}
 
Example #5
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectConnectionException() throws ConnectionException, AuthenticationException {
    doThrow(new ConnectionException("")).when(this.wagon).connectToRepository(this.repository,
            this.authenticationInfo, this.proxyInfoProvider);

    try {
        this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfoProvider);
        fail();
    } catch (ConnectionException e) {
        assertEquals(this.repository, this.wagon.getRepository());
        verify(this.sessionListenerSupport).fireSessionOpening();
        verify(this.sessionListenerSupport).fireSessionConnectionRefused();
    }
}
 
Example #6
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectRepositoryAuthenticationInfoProxyInfoProvider() throws ConnectionException,
        AuthenticationException {
    this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfoProvider);

    assertEquals(this.repository, this.wagon.getRepository());
    verify(this.sessionListenerSupport).fireSessionOpening();
    verify(this.wagon).connectToRepository(this.repository, this.authenticationInfo, this.proxyInfoProvider);
    verify(this.sessionListenerSupport).fireSessionLoggedIn();
    verify(this.sessionListenerSupport).fireSessionOpened();
}
 
Example #7
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectRepositoryAuthenticationProxyInfo() throws ConnectionException, AuthenticationException {
    this.wagon.connect(this.repository, this.authenticationInfo, this.proxyInfo);

    assertEquals(this.repository, this.wagon.getRepository());
    verify(this.sessionListenerSupport).fireSessionOpening();
    verify(this.wagon).connectToRepository(eq(this.repository), eq(this.authenticationInfo),
            any(NullProtectingProxyInfoProvider.class));
    verify(this.sessionListenerSupport).fireSessionLoggedIn();
    verify(this.sessionListenerSupport).fireSessionOpened();

}
 
Example #8
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectRepositoryProxyInfoProvider() throws ConnectionException, AuthenticationException {
    this.wagon.connect(this.repository, this.proxyInfoProvider);

    assertEquals(this.repository, this.wagon.getRepository());
    verify(this.sessionListenerSupport).fireSessionOpening();
    verify(this.wagon).connectToRepository(this.repository, null, this.proxyInfoProvider);
    verify(this.sessionListenerSupport).fireSessionLoggedIn();
    verify(this.sessionListenerSupport).fireSessionOpened();
}
 
Example #9
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectRepositoryAuthenticationInfo() throws ConnectionException, AuthenticationException {
    this.wagon.connect(this.repository, this.authenticationInfo);

    assertEquals(this.repository, this.wagon.getRepository());
    verify(this.sessionListenerSupport).fireSessionOpening();
    verify(this.wagon).connectToRepository(this.repository, this.authenticationInfo, null);
    verify(this.sessionListenerSupport).fireSessionLoggedIn();
    verify(this.sessionListenerSupport).fireSessionOpened();
}
 
Example #10
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 #11
Source File: AbstractWagonTest.java    From lambadaframework with MIT License 5 votes vote down vote up
@Test
public void connectRepository() throws ConnectionException, AuthenticationException {
    this.wagon.connect(this.repository);

    assertEquals(this.repository, this.wagon.getRepository());
    verify(this.sessionListenerSupport).fireSessionOpening();
    verify(this.wagon).connectToRepository(this.repository, null, null);
    verify(this.sessionListenerSupport).fireSessionLoggedIn();
    verify(this.sessionListenerSupport).fireSessionOpened();
}
 
Example #12
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 #13
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 #14
Source File: MockWagon.java    From archiva with Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public void openConnection()
    throws ConnectionException, AuthenticationException
{

}
 
Example #15
Source File: GitWagon.java    From opoopress with Apache License 2.0 5 votes vote down vote up
@Override
protected void openConnectionInternal() throws ConnectionException, AuthenticationException {
	if (checkoutDirectory == null) {
		checkoutDirectory = createCheckoutDirectory();
	}

	if (checkoutDirectory.exists() && safeCheckout) {
		removeCheckoutDirectory();
	}

	checkoutDirectory.mkdirs();
}
 
Example #16
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 #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, ProxyInfo proxyInfo )
    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, ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{

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

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

}
 
Example #21
Source File: GitHubWagon.java    From opoopress with Apache License 2.0 4 votes vote down vote up
@Override
protected void openConnectionInternal() throws ConnectionException,
		AuthenticationException {
	fireSessionDebug("openConnectionInternal");
}
 
Example #22
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 #23
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 #24
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 #25
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository source, ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{
    delegate.connect( source, proxyInfoProvider );
}
 
Example #26
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository source, ProxyInfo proxyInfo )
    throws ConnectionException, AuthenticationException
{
    delegate.connect( source, proxyInfo );
}
 
Example #27
Source File: WagonDelegate.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Override
public void connect( Repository source )
    throws ConnectionException, AuthenticationException
{
    delegate.connect( source );
}
 
Example #28
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 #29
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 #30
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));
}