本文整理汇总了Java中org.apache.maven.settings.Server.getPassword方法的典型用法代码示例。如果您正苦于以下问题:Java Server.getPassword方法的具体用法?Java Server.getPassword怎么用?Java Server.getPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.settings.Server
的用法示例。
在下文中一共展示了Server.getPassword方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdminClient
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
public SVNAdminClient getAdminClient() {
if (adminClient == null) {
String authenticationId = svnRepository.getAuthenticationId();
if (!StringUtils.isBlank(authenticationId)) {
}
Server serverSettings = mavenContext
.getServerSettings(authenticationId);
String username = serverSettings.getUsername();
String password = serverSettings.getPassword();
DefaultSVNOptions defaultSVNOptions = new DefaultSVNOptions();
SVNClientManager clientManager = SVNClientManager.newInstance(
defaultSVNOptions, username, password);
adminClient = clientManager.getAdminClient();
}
return adminClient;
}
示例2: getPassword
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
public String getPassword() throws GoalParameterException {
String password = driverConfig.getPassword();
if (password == null) {
String serverId = driverConfig.getServerId();
if (StringUtils.isBlank(serverId)) {
throw new GoalParameterException(
"No passowrd nor a serverId is configured.");
}
Server serverSettings = mavenContext.getServerSettings(serverId
.trim());
if (serverSettings == null) {
throw new GoalParameterException(
"Maven settings does not contain server configuration "
+ serverId);
}
password = serverSettings.getPassword();
}
if (password == null) {
password = "";
}
return password;
}
示例3: loadUserInfoFromSettings
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
* Issue 39
*
* Load username password from settings if user has not set them in JVM properties
*
* @throws MojoExecutionException
*/
protected void loadUserInfoFromSettings() throws MojoExecutionException {
if ((getUsername() == null || getPassword() == null) && (mavenSettings != null)) {
if (this.serverId == null)
throw new MojoExecutionException("SettingKey must be set! (username and/or password are not provided)");
Server server = this.mavenSettings.getServer(this.serverId);
if (server == null)
throw new MojoExecutionException(String.format("server with id [%s] not found in settings!", this.serverId));
if (getUsername() == null && server.getUsername() != null) username = server.getUsername();
if (getPassword() == null && server.getPassword() != null) {
try {
//
// FIX to resolve
// org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException:
// java.io.FileNotFoundException: ~/.settings-security.xml (No such file or directory)
//
if (securityDispatcher instanceof DefaultSecDispatcher) {
//System.setProperty( DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION, sb.toString() );
((DefaultSecDispatcher) securityDispatcher).setConfigurationFile("~/.m2/settings-security.xml");
}
password = securityDispatcher.decrypt(server.getPassword());
} catch (SecDispatcherException e) {
throw new MojoExecutionException(e.getMessage());
}
}
}
}
示例4: loadUserInfoFromSettings
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
* Load username password from settings if user has not set them in JVM properties
*/
private void loadUserInfoFromSettings()
throws MojoExecutionException
{
if ( this.settingsKey == null )
{
this.settingsKey = url;
}
if ( ( username == null || password == null ) && ( settings != null ) )
{
Server server = this.settings.getServer( this.settingsKey );
if ( server != null )
{
if ( username == null )
{
username = server.getUsername();
}
if ( password == null )
{
password = server.getPassword();
}
}
}
if ( username == null )
{
//allow emtpy username
username = "" ;
}
if ( password == null )
{
//allow emtpy password
password = "" ;
}
}
示例5: loadUserInfoFromSettings
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
* Load username password from settings if user has not set them in JVM properties
*/
private void loadUserInfoFromSettings()
throws MojoExecutionException {
if (this.settingsKey == null) {
this.settingsKey = url;
}
if ((username == null || password == null) && (settings != null)) {
Server server = this.settings.getServer(this.settingsKey);
if (server != null) {
if (username == null) {
username = server.getUsername();
}
if (password == null) {
password = server.getPassword();
}
}
}
if (username == null) {
//allow emtpy username
username = "";
}
if (password == null) {
//allow emtpy password
password = "";
}
}
示例6: MavenAuthentication
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
private MavenAuthentication(Server server) {
Builder<String, String> builder = ImmutableMap.<String, String>builder();
// From https://maven.apache.org/settings.html: "If you use a private key to login to the
// server, make sure you omit the <password> element. Otherwise, the key will be ignored."
if (server.getPassword() != null) {
builder.put(AuthenticationContext.USERNAME, server.getUsername());
builder.put(AuthenticationContext.PASSWORD, server.getPassword());
} else if (server.getPrivateKey() != null) {
// getPrivateKey sounds like it returns the key, but it actually returns a path to it.
builder.put(AuthenticationContext.PRIVATE_KEY_PATH, server.getPrivateKey());
builder.put(AuthenticationContext.PRIVATE_KEY_PASSPHRASE, server.getPassphrase());
}
authenticationInfo = builder.build();
}
示例7: applyAuthenticationIfAny
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
private void applyAuthenticationIfAny(SVNRepository svnKitRepository) {
String authenticationId = svnRepository.getAuthenticationId();
ISVNAuthenticationManager authManager = null;
if (StringUtils.isNotBlank(authenticationId)) {
Server serverSettings = mavenContext
.getServerSettings(authenticationId);
String username = serverSettings.getUsername();
String password = serverSettings.getPassword();
authManager = SVNWCUtil.createDefaultAuthenticationManager(
username, password);
svnKitRepository.setAuthenticationManager(authManager);
}
}
示例8: execute
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
* Execute the mojo.
*
* @throws MojoExecutionException
*/
@Override
public void execute() throws MojoExecutionException {
Log log = getLog();
boolean debugEnabled = log.isDebugEnabled();
for (Server server : this.settings.getServers()) {
String settingsKey = server.getId();
String username = server.getUsername();
String password = server.getPassword();
String usernameProperty = settingsKey + "."
+ DEFAULT_USERNAME_PROPERTY_SUFFIX;
String passwordProperty = settingsKey + "."
+ DEFAULT_PASSWORD_PROPERTY_SUFFIX;
if (!project.getProperties().containsKey(usernameProperty))
project.getProperties().setProperty(usernameProperty, username);
if (!project.getProperties().containsKey(passwordProperty))
project.getProperties().setProperty(passwordProperty, password);
if (useSystemProperties) {
if (System.getProperty(usernameProperty) == null)
System.setProperty(usernameProperty, username);
if (System.getProperty(passwordProperty) == null)
System.setProperty(passwordProperty, password);
}
if (debugEnabled)
log.debug(String.format("username property '%s' is '%s'",
usernameProperty, username));
if (debugEnabled)
log.debug(String.format("password property '%s' is '%s'",
passwordProperty, password));
}
}
示例9: loadUserInfoFromSettings
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
* Load username password from settings if user has not set them in JVM properties
*
* @throws MojoExecutionException
*/
private void loadUserInfoFromSettings()
throws MojoExecutionException
{
if ( this.settingsKey == null )
{
this.settingsKey = getUrl();
}
if ( ( getUsername() == null || getPassword() == null ) && ( settings != null ) )
{
Server server = this.settings.getServer( this.settingsKey );
if ( server != null )
{
if ( getUsername() == null )
{
setUsername( server.getUsername() );
}
if ( getPassword() == null && server.getPassword() != null )
{
try
{
setPassword( securityDispatcher.decrypt( server.getPassword() ) );
}
catch ( SecDispatcherException e )
{
throw new MojoExecutionException( e.getMessage() );
}
}
}
}
if ( getUsername() == null )
{
// allow empty username
setUsername( "" );
}
if ( getPassword() == null )
{
// allow empty password
setPassword( "" );
}
}
示例10: AWSCredentialsImpl
import org.apache.maven.settings.Server; //导入方法依赖的package包/类
public AWSCredentialsImpl(final Server server) {
this.accessKey = server.getUsername();
this.secretKey = server.getPassword();
}