本文整理汇总了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");
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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());
}
}
}
}
示例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 );
}
}
示例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;
}
}
示例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;
}
}
示例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 );
}
}
示例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;
}
示例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( "" );
}
}
示例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 );
}