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


Java SecDispatcherException类代码示例

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


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

示例1: setUsernameAndPassword

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private void setUsernameAndPassword() throws MojoFailureException, MojoExecutionException {
	if(serverId != null){
		Server server = settings.getServer(serverId);
		if (server == null) {
			throw new MojoFailureException("Unable to find any server identified by \"" + serverId + "\" in your settings.xml");
		} else {
			username = server.getUsername();
			try {
				password = secDispatcher.decrypt(server.getPassword());
			} catch (SecDispatcherException e) {
				password = server.getPassword();
			}
		}
	} else if (username == null || password == null){
		throw new MojoExecutionException("Nether serverId or username and password for confluence defined");
	}
}
 
开发者ID:sixro,项目名称:confluence-maven-plugin,代码行数:18,代码来源:Deploy.java

示例2: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private static String decrypt(final SettingsDecrypter settingsDecrypter,
    final String possiblyEncrypted)
{
  if (settingsDecrypter != null)
  {
    try
    {
      final String decrypted = settingsDecrypter.decrypt(possiblyEncrypted);
      return decrypted;
    }
    catch (final SecDispatcherException e)
    {
      // ok, continue with the unencrypted...
    }
  }
  return possiblyEncrypted;
}
 
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:18,代码来源:ScmCredentials.java

示例3: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private String decrypt(String key, String value) {
  try {
    return securityDispatcher.decrypt(value);
  } catch (SecDispatcherException e) {
    log.debug("Unable to decrypt property " + key, e);
    return value;
  }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:9,代码来源:PropertyDecryptor.java

示例4: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private String decrypt(String pass) {
  try {
    pass = getComponent(SecDispatcher.class, "maven").decrypt(pass);
  }
  catch (SecDispatcherException e) {
    MavenEmbedderLog.LOG.warn(e);
  }
  return pass;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MavenEmbedder.java

示例5: loadUserInfoFromSettings

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的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());
            }
        }
    }
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:43,代码来源:AbstractBaseConfluenceMojo.java

示例6: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private String decrypt( String encoded )
        throws MojoExecutionException
{
    try
    {
        return securityDispatcher.decrypt( encoded );
    }
    catch ( SecDispatcherException e )
    {
        throw new MojoExecutionException( "error using security dispatcher: " + e.getMessage(), e );
    }
}
 
开发者ID:mojohaus,项目名称:webstart,代码行数:13,代码来源:SignConfig.java

示例7: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private String decrypt( String str, String server )
{
    try
    {
        return securityDispatcher.decrypt( str );
    }
    catch ( SecDispatcherException e )
    {
        getLog().warn( "Failed to decrypt password/passphrase for server " + server + ", using auth token as is" );
        return str;
    }
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:13,代码来源:AbstractScmMojo.java

示例8: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
/**
 * Decrypt a given encrypted password.
 * @param password
 * @return
 */
private String decrypt(String password) {
	try {
		return secDispatcher.decrypt(password);
	} catch (SecDispatcherException sde) {
		log.warn("Error occurred while decrypting password", sde);
		return password;
	}
}
 
开发者ID:wso2,项目名称:maven-tools,代码行数:14,代码来源:MavenReleasePrePrepareMojo.java

示例9: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
protected String decrypt(String encoded) throws MojoExecutionException {
    try {
        return securityDispatcher.decrypt( encoded );

    } catch ( SecDispatcherException e ) {
        getLog().error( "error using security dispatcher: " + e.getMessage(), e );
        throw new MojoExecutionException( "error using security dispatcher: " + e.getMessage(), e );
    }
}
 
开发者ID:Shusshu,项目名称:Rob-Maven-and-Gradle-Plugins,代码行数:10,代码来源:RobLogsMojo.java

示例10: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
/**
 * Decrypts the given value if the security dispatcher is initialized with a
 * valid configuration.
 *
 * @param encrypted the value to decrypt.
 * @return the decrypted value or the unchanged {@code encrypted}.
 * @throws SecDispatcherException if the decryption failed.
 */
public String decrypt(final String encrypted) throws SecDispatcherException
{
  if (settingsSecurityLocation != null)
  {
    return securityDispatcher.decrypt(encrypted);
  }
  return encrypted;
}
 
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:17,代码来源:SettingsDecrypter.java

示例11: loadUserInfoFromSettings

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的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( "" );
    }
}
 
开发者ID:mojohaus,项目名称:sql-maven-plugin,代码行数:51,代码来源:SqlExecMojo.java

示例12: decrypt

import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; //导入依赖的package包/类
private String decrypt( String str )
    throws SecDispatcherException
{
    return ( str == null ) ? null : securityDispatcher.decrypt( str );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:6,代码来源:DefaultSettingsDecrypter.java


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