当前位置: 首页>>代码示例>>Java>>正文


Java DefaultSettingsDecryptionRequest类代码示例

本文整理汇总了Java中org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest的典型用法代码示例。如果您正苦于以下问题:Java DefaultSettingsDecryptionRequest类的具体用法?Java DefaultSettingsDecryptionRequest怎么用?Java DefaultSettingsDecryptionRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultSettingsDecryptionRequest类属于org.apache.maven.settings.crypto包,在下文中一共展示了DefaultSettingsDecryptionRequest类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAwsKeyPair

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
static AwsKeyPair getAwsKeyPair(String serverId, String awsAccessKey, String awsSecretAccessKey,
        Settings settings, SettingsDecrypter decrypter) throws MojoExecutionException {
    final AwsKeyPair keys;
    if (serverId != null) {
        Server server = settings.getServer(serverId);
        if (server == null) {
            throw new MojoExecutionException("serverId not found in settings: " + serverId);
        } else {
            SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(server);
            SettingsDecryptionResult result = decrypter.decrypt(request);
            keys = new AwsKeyPair(result.getServer().getUsername(),
                    result.getServer().getPassword());
        }
    } else {
        keys = new AwsKeyPair(awsAccessKey, awsSecretAccessKey);
    }
    return keys;
}
 
开发者ID:davidmoten,项目名称:aws-maven-plugin,代码行数:19,代码来源:Util.java

示例2: getRemoteRepositories

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
/**
 * List of remote repositories to resolve artifacts from.
 */
@Provides @Singleton
public List<RemoteRepository> getRemoteRepositories(
        SettingsDecrypter decrypter,
        ExtensionList<RemoteRepositoryDecorator> decorators) {

    List<RemoteRepository> repositories = new ArrayList<RemoteRepository>();
    MavenDependencyResolverSettings resolverSettings = new MavenDependencyResolverSettings();
    resolverSettings.setUseMavenCentral(true);
    List<RemoteRepository> repos = resolverSettings.getRemoteRepositories();
    for (RemoteRepository remoteRepository : repos) {
        Server server = resolverSettings.getSettings().getServer(remoteRepository.getId());
        if (server != null) {
            server = decrypter.decrypt(new DefaultSettingsDecryptionRequest(server)).getServer();
            remoteRepository.setAuthentication(new Authentication(server.getUsername(), server.getPassword(), server.getPrivateKey(), server.getPassphrase()));
        }
        repositories.add(decorate(remoteRepository, decorators));
    }
    RemoteRepository r = new RemoteRepository("cloudbees-public-release", "default", "https://repository-cloudbees.forge.cloudbees.com/public-release/");
    repositories.add(decorate(r,decorators));
    return repositories;
}
 
开发者ID:cloudbees,项目名称:bees-maven-components,代码行数:25,代码来源:RepositorySystemModule.java

示例3: getArchetypes

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
@Override
public List<Archetype> getArchetypes() {
    File root = Places.getCacheSubdirectory("mavenarchetypes"); //NOI18N
    ArrayList<Archetype> toRet = new ArrayList<Archetype>();
    MavenEmbedder embedder = EmbedderFactory.getOnlineEmbedder();
    SettingsDecryptionResult settings = embedder.lookupComponent(SettingsDecrypter.class).decrypt(new DefaultSettingsDecryptionRequest(embedder.getSettings()));
    
    for (RepositoryInfo info : RepositoryPreferences.getInstance().getRepositoryInfos()) {
        if (info.isRemoteDownloadable()) {
            File catalog = new File(new File( root, info.getId()), "archetype-catalog.xml"); //NOI18N
            boolean download = false;
            if (!catalog.exists()) {
                download = true;
            } else {
                long lastM = catalog.lastModified();
                if (lastM == 0) {
                    download = true;
                } else if (lastM - System.currentTimeMillis() > ARCHETYPE_TIMEOUT) {
                    download = true;
                }
            }
            
            if (download) {
                download(info.getId(), info.getRepositoryUrl(), catalog, settings, embedder);
            }
            
            if (catalog.exists()) {
                try {
                    toRet.addAll(CatalogRepoProvider.getArchetypes(Utilities.toURI(catalog).toURL(), info.getRepositoryUrl()));
                } catch (MalformedURLException ex) {
                    LOG.log(Level.INFO, null, ex);
                }
            }
        }
    }
    
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:CatalogRepoProvider.java

示例4: decryptServer

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
static Server decryptServer(String serverId, MavenSession mavenSession, SettingsDecrypter decrypter) {
    if (StringUtils.isEmpty(serverId)) {
        return null;
    }
    Server server = mavenSession.getSettings().getServer(serverId);
    if (server != null) {
        final DefaultSettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(server);
        SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest);
        return decryptedResult.getServer();
    } else {
        LOGGER.warn("Could not find server '" + serverId + "' in settings.xml");
        return null;
    }
}
 
开发者ID:eirslett,项目名称:frontend-maven-plugin,代码行数:15,代码来源:MojoUtils.java

示例5: injectProxy

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
public void injectProxy( List<ArtifactRepository> repositories, List<org.apache.maven.settings.Proxy> proxies )
{
    if ( repositories != null )
    {
        for ( ArtifactRepository repository : repositories )
        {
            org.apache.maven.settings.Proxy proxy = getProxy( repository, proxies );

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

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

                Proxy p = new Proxy();
                p.setHost( proxy.getHost() );
                p.setProtocol( proxy.getProtocol() );
                p.setPort( proxy.getPort() );
                p.setNonProxyHosts( proxy.getNonProxyHosts() );
                p.setUserName( proxy.getUsername() );
                p.setPassword( proxy.getPassword() );

                repository.setProxy( p );
            }
            else
            {
                repository.setProxy( null );
            }
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:LegacyRepositorySystem.java

示例6: getAuthenticationInfo

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
public AuthenticationInfo getAuthenticationInfo( String id )
{
    MavenSession session = legacySupport.getSession();

    if ( session != null && id != null )
    {
        MavenExecutionRequest request = session.getRequest();

        if ( request != null )
        {
            List<Server> servers = request.getServers();

            if ( servers != null )
            {
                for ( Server server : servers )
                {
                    if ( id.equalsIgnoreCase( server.getId() ) )
                    {
                        SettingsDecryptionResult result =
                            settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( server ) );
                        server = result.getServer();

                        AuthenticationInfo authInfo = new AuthenticationInfo();
                        authInfo.setUserName( server.getUsername() );
                        authInfo.setPassword( server.getPassword() );
                        authInfo.setPrivateKey( server.getPrivateKey() );
                        authInfo.setPassphrase( server.getPassphrase() );

                        return authInfo;
                    }
                }
            }
        }
    }

    // empty one to prevent NPE
   return new AuthenticationInfo();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:39,代码来源:DefaultWagonManager.java

示例7: getProxy

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
public ProxyInfo getProxy( String protocol )
{
    MavenSession session = legacySupport.getSession();

    if ( session != null && protocol != null )
    {
        MavenExecutionRequest request = session.getRequest();

        if ( request != null )
        {
            List<Proxy> proxies = request.getProxies();

            if ( proxies != null )
            {
                for ( Proxy proxy : proxies )
                {
                    if ( proxy.isActive() && protocol.equalsIgnoreCase( proxy.getProtocol() ) )
                    {
                        SettingsDecryptionResult result =
                            settingsDecrypter.decrypt( new DefaultSettingsDecryptionRequest( proxy ) );
                        proxy = result.getProxy();

                        ProxyInfo proxyInfo = new ProxyInfo();
                        proxyInfo.setHost( proxy.getHost() );
                        proxyInfo.setType( proxy.getProtocol() );
                        proxyInfo.setPort( proxy.getPort() );
                        proxyInfo.setNonProxyHosts( proxy.getNonProxyHosts() );
                        proxyInfo.setUserName( proxy.getUsername() );
                        proxyInfo.setPassword( proxy.getPassword() );

                        return proxyInfo;
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:DefaultWagonManager.java

示例8: getDecryptedServer

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
/**
* Decrypt settings and return the server element with the given id.  Useful for e.g., reading encrypted 
* user credentials.
* <p>
* Refer to http://maven.apache.org/guides/mini/guide-encryption.html
* 
* @param id the id of the server to be decrypted
* @return a Server with its protected elements decrypted, if one is found with the given id.  Null otherwise.
*/
  protected Server getDecryptedServer(String id) { 
      final SettingsDecryptionRequest settingsDecryptionRequest = new DefaultSettingsDecryptionRequest(); 
      settingsDecryptionRequest.setServers(settings.getServers()); 
      final SettingsDecryptionResult decrypt = settingsDecrypter.decrypt(settingsDecryptionRequest); 
      List<Server> servers = decrypt.getServers();
      
      for (Server server : servers) {
      	if (server.getId().equals(id)) {
      		return server;
      	}
      }
      return null;
  }
 
开发者ID:isomorphic-software,项目名称:isc-maven-plugin,代码行数:23,代码来源:AbstractPackagerMojo.java

示例9: decryptSettings

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
private SettingsDecryptionResult decryptSettings(Settings settings) {
	DefaultSettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(
			settings);

	return createSettingsDecrypter().decrypt(request);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:MavenSettingsReader.java

示例10: decryptSettings

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
private SettingsDecryptionResult decryptSettings(Settings settings) {
    DefaultSettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(
            settings);

    return createSettingsDecrypter().decrypt(request);
}
 
开发者ID:igor-suhorukov,项目名称:mvn-classloader,代码行数:7,代码来源:MavenSettingsReader.java

示例11: decryptProxy

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
private static Proxy decryptProxy(Proxy proxy, SettingsDecrypter decrypter) {
    final DefaultSettingsDecryptionRequest decryptionRequest = new DefaultSettingsDecryptionRequest(proxy);
    SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest);
    return decryptedResult.getProxy();
}
 
开发者ID:eirslett,项目名称:frontend-maven-plugin,代码行数:6,代码来源:MojoUtils.java

示例12: decryptProxy

import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; //导入依赖的package包/类
private static Proxy decryptProxy(Proxy proxy, SettingsDecrypter decrypter) {
    final DefaultSettingsDecryptionRequest decryptionRequest =
            new DefaultSettingsDecryptionRequest(proxy);
    SettingsDecryptionResult decryptedResult = decrypter.decrypt(decryptionRequest);
    return decryptedResult.getProxy();
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:7,代码来源:MojoUtils.java


注:本文中的org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。