本文整理汇总了Java中org.apache.maven.settings.crypto.SettingsDecryptionResult.getServers方法的典型用法代码示例。如果您正苦于以下问题:Java SettingsDecryptionResult.getServers方法的具体用法?Java SettingsDecryptionResult.getServers怎么用?Java SettingsDecryptionResult.getServers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.crypto.SettingsDecryptionResult
的用法示例。
在下文中一共展示了SettingsDecryptionResult.getServers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
示例2: 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;
}