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


Java SettingsDecryptionResult类代码示例

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


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

示例1: getAwsKeyPair

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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: getArchetypes

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例3: MavenSettings

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的package包/类
/**
 * Create a new {@link MavenSettings} instance.
 * @param settings the source settings
 * @param decryptedSettings the decrypted settings
 */
public MavenSettings(Settings settings, SettingsDecryptionResult decryptedSettings) {
	this.offline = settings.isOffline();
	this.mirrorSelector = createMirrorSelector(settings);
	this.authenticationSelector = createAuthenticationSelector(decryptedSettings);
	this.proxySelector = createProxySelector(decryptedSettings);
	this.localRepository = settings.getLocalRepository();
	this.activeProfiles = determineActiveProfiles(settings);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:MavenSettings.java

示例4: createAuthenticationSelector

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的package包/类
private AuthenticationSelector createAuthenticationSelector(
		SettingsDecryptionResult decryptedSettings) {
	DefaultAuthenticationSelector selector = new DefaultAuthenticationSelector();
	for (Server server : decryptedSettings.getServers()) {
		AuthenticationBuilder auth = new AuthenticationBuilder();
		auth.addUsername(server.getUsername()).addPassword(server.getPassword());
		auth.addPrivateKey(server.getPrivateKey(), server.getPassphrase());
		selector.add(server.getId(), auth.build());
	}
	return new ConservativeAuthenticationSelector(selector);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:MavenSettings.java

示例5: createProxySelector

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的package包/类
private ProxySelector createProxySelector(
		SettingsDecryptionResult decryptedSettings) {
	DefaultProxySelector selector = new DefaultProxySelector();
	for (Proxy proxy : decryptedSettings.getProxies()) {
		Authentication authentication = new AuthenticationBuilder()
				.addUsername(proxy.getUsername()).addPassword(proxy.getPassword())
				.build();
		selector.add(
				new org.eclipse.aether.repository.Proxy(proxy.getProtocol(),
						proxy.getHost(), proxy.getPort(), authentication),
				proxy.getNonProxyHosts());
	}
	return selector;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:MavenSettings.java

示例6: readSettings

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的package包/类
public MavenSettings readSettings() {
	Settings settings = loadSettings();
	SettingsDecryptionResult decrypted = decryptSettings(settings);
	if (!decrypted.getProblems().isEmpty()) {
		Log.error(
				"Maven settings decryption failed. Some Maven repositories may be inaccessible");
		// Continue - the encrypted credentials may not be used
	}
	return new MavenSettings(settings, decrypted);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:MavenSettingsReader.java

示例7: readSettings

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的package包/类
public MavenSettings readSettings() {
	Settings settings = loadSettings();
	SettingsDecryptionResult decrypted = decryptSettings(settings);
	if (!decrypted.getProblems().isEmpty()) {
		log.error(
				"Maven settings decryption failed. Some Maven repositories may be inaccessible");
		// Continue - the encrypted credentials may not be used
	}
	return new MavenSettings(settings, decrypted);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-function,代码行数:11,代码来源:MavenSettingsReader.java

示例8: readSettings

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的package包/类
public MavenSettings readSettings() {
    Settings settings = loadSettings();
    SettingsDecryptionResult decrypted = decryptSettings(settings);
    if (!decrypted.getProblems().isEmpty()) {
        Log.error(
                "Maven settings decryption failed. Some Maven repositories may be inaccessible");
        // Continue - the encrypted credentials may not be used
    }
    if(Boolean.getBoolean("mavenSettings.offline")) {
        settings.setOffline(true);
    }
    return new MavenSettings(settings, decrypted);
}
 
开发者ID:igor-suhorukov,项目名称:mvn-classloader,代码行数:14,代码来源:MavenSettingsReader.java

示例9: decryptServer

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例10: injectProxy

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例11: getAuthenticationInfo

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例12: getProxy

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例13: getDecryptedServer

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例14: decryptSettings

import org.apache.maven.settings.crypto.SettingsDecryptionResult; //导入依赖的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

示例15: decryptSettings

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

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


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