Package org.apache.maven.settings

Examples of org.apache.maven.settings.Server


                                       proxy.getPassword(), proxy.getNonProxyHosts() );
            }

            for ( Iterator i = settings.getServers().iterator(); i.hasNext(); )
            {
                Server server = (Server) i.next();

                wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), server.getPassword(),
                                                    server.getPrivateKey(), server.getPassphrase() );

                // Remove once Wagon is upgraded to 1.0-beta-5
                if ( server.getPassword() != null )
                {
                    // setting this globally is not ideal, but not harmful
                    com.jcraft.jsch.JSch.setConfig( "PreferredAuthentications", "gssapi-with-mic,publickey,password,keyboard-interactive" );
                }

                wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
                                                server.getDirectoryPermissions() );

                if ( server.getConfiguration() != null )
                {
                    wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
                }
            }

            RepositoryPermissions defaultPermissions = new RepositoryPermissions();
View Full Code Here


                                           pass, proxy.getNonProxyHosts() );
                }
               
                for ( Iterator i = settings.getServers().iterator(); i.hasNext(); )
                {
                    Server server = (Server) i.next();
                   
                    String passWord = server.getPassword();
   
                    if ( sd != null )
                    {
                        try
                        {
                            passWord = sd.decrypt( passWord );
                        }
                        catch ( SecDispatcherException e )
                        {
                            reportSecurityConfigurationError( "password for server '" + server.getId() + "'", e );
                        }
                    }
                   
                    String passPhrase = server.getPassphrase();
   
                    if ( sd != null )
                    {
                        try
                        {
                            passPhrase = sd.decrypt( passPhrase );
                        }
                        catch ( SecDispatcherException e )
                        {
                            reportSecurityConfigurationError( "passphrase for server '" + server.getId() + "'", e );
                        }
                    }
   
                    wagonManager.addAuthenticationInfo( server.getId(), server.getUsername(), passWord,
                                                        server.getPrivateKey(), passPhrase );
   
                    wagonManager.addPermissionInfo( server.getId(), server.getFilePermissions(),
                                                    server.getDirectoryPermissions() );
   
                    if ( server.getConfiguration() != null )
                    {
                        wagonManager.addConfiguration( server.getId(), (Xpp3Dom) server.getConfiguration() );
                    }
                }
   
                for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
                {
View Full Code Here

    public void testGetConfiguredRepositoryWithHost()
        throws ScmRepositoryException, NoSuchScmProviderException
    {
        Settings settings = new Settings();
        Server server = new Server();
        server.setId( "localhost:" + CVS_PORT );
        server.setUsername( "settings-username" );
        server.setPassword( "settings-password" );
        server.setPrivateKey( "settings-private-key" );
        server.setPassphrase( "settings-passphrase" );
        settings.addServer( server );

        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
        releaseDescriptor.setScmSourceUrl( "scm:cvs:pserver:anoncvs@localhost:/home/cvs:module" );
View Full Code Here

    public void testGetConfiguredRepositoryWithEncryptedPasswords()
        throws ScmRepositoryException, NoSuchScmProviderException
    {
        Settings settings = new Settings();
        Server server = new Server();
        server.setId( "localhost" );
        server.setUsername( "testuser" );
        server.setPassword( "{Ael0S2tnXv8H3X+gHKpZAvAA25D8+gmU2w2RrGaf5v8=}" );
        server.setPassphrase( "{7zK9P8hNVeUHbTsjiA/vnOs0zUXbND+9MBNPvdvl+x4=}" );
        settings.addServer( server );

        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
        releaseDescriptor.setScmSourceUrl( "scm:svn:svn://localhost/repo" );
View Full Code Here

                }
            }

            for ( ArtifactRepository repository : repositories )
            {
                Server server = serversById.get( repository.getId() );

                if ( server != null )
                {
                    SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( server );
                    SettingsDecryptionResult result = settingsDecrypter.decrypt( request );
                    server = result.getServer();

                    if ( logger.isDebugEnabled() )
                    {
                        for ( SettingsProblem problem : result.getProblems() )
                        {
                            logger.debug( problem.getMessage(), problem.getException() );
                        }
                    }

                    Authentication authentication = new Authentication( server.getUsername(), server.getPassword() );

                    repository.setAuthentication( authentication );
                }
                else
                {
View Full Code Here

        {
            Set<String> serverIds = new HashSet<String>();

            for ( int i = 0; i < servers.size(); i++ )
            {
                Server server = servers.get( i );

                validateStringNotEmpty( problems, "servers.server[" + i + "].id", server.getId(), null );

                if ( !serverIds.add( server.getId() ) )
                {
                    addViolation( problems, Severity.WARNING, "servers.server.id", null,
                                  "must be unique but found duplicate server with id " + server.getId() );
                }
            }
        }

        List<Mirror> mirrors = settings.getMirrors();
View Full Code Here

    extends Settings
{
    /** {@inheritDoc} */
    public Server getServer( String serverId )
    {
        return new Server()
        {
            /** {@inheritDoc} */
            public String getUsername()
            {
                return "anonymous";
View Full Code Here

            if ( port > 0 )
            {
                host += ":" + port;
            }

            Server server = this.settings.getServer( host );

            if ( server != null )
            {
                if ( username == null )
                {
                    username = server.getUsername();
                }

                if ( password == null )
                {
                    password = decrypt( server.getPassword(), host );
                }

                if ( privateKey == null )
                {
                    privateKey = server.getPrivateKey();
                }

                if ( passphrase == null )
                {
                    passphrase = decrypt( server.getPassphrase(), host );
                }
            }
        }
    }
View Full Code Here

            && project != null
            && project.getDistributionManagement() != null
            && ( project.getDistributionManagement().getRepository() != null || project.getDistributionManagement().getSnapshotRepository() != null )
            && ( StringUtils.isNotEmpty( project.getDistributionManagement().getRepository().getUrl() ) || StringUtils.isNotEmpty( project.getDistributionManagement().getSnapshotRepository().getUrl() ) ) )
        {
            Server server = null;
            if ( url.toString().contains( project.getDistributionManagement().getRepository().getUrl() ) )
            {
                server = settings.getServer( project.getDistributionManagement().getRepository().getId() );
            }
            if ( server == null
                && url.toString().contains( project.getDistributionManagement().getSnapshotRepository().getUrl() ) )
            {
                server = settings.getServer( project.getDistributionManagement().getSnapshotRepository().getId() );
            }

            if ( server != null && StringUtils.isNotEmpty( server.getUsername() )
                && StringUtils.isNotEmpty( server.getPassword() ) )
            {
                String up = server.getUsername().trim() + ":" + server.getPassword().trim();
                String upEncoded = new String( Base64.encodeBase64Chunked( up.getBytes() ) ).trim();

                conn.setRequestProperty( "Authorization", "Basic " + upEncoded );
            }
        }
View Full Code Here

            if ( port > 0 )
            {
                host += ":" + port;
            }

            Server server = this.settings.getServer( host );

            if ( server != null )
            {
                if ( username == null )
                {
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.Server

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.