Spring Web Services Framework

org.springframework.ws.soap.security.wss4j.support
Class CryptoFactoryBean

java.lang.Object
  extended by org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean
All Implemented Interfaces:
Aware, BeanClassLoaderAware, FactoryBean<Crypto>, InitializingBean

public class CryptoFactoryBean
extends Object
implements FactoryBean<Crypto>, BeanClassLoaderAware, InitializingBean

Spring factory bean for a WSS4J Crypto. Allows for strong-typed property configuration, or configuration through Properties.

Requires either individual properties, or the configuration property to be set.

Since:
1.5.0
Author:
Tareq Abed Rabbo, Arjen Poutsma
See Also:
Crypto

Constructor Summary
CryptoFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 Crypto getObject()
           
 Class<Crypto> getObjectType()
           
 boolean isSingleton()
           
 void setBeanClassLoader(ClassLoader classLoader)
           
 void setConfiguration(Properties properties)
          Sets the configuration of the Crypto.
 void setCryptoProvider(Class<? extends Crypto> cryptoProviderClass)
          Sets the Crypto provider name.
 void setDefaultX509Alias(String defaultX509Alias)
          Sets the alias name of the default certificate which has been specified as a property.
 void setKeyStoreLocation(Resource location)
          Sets the location of the key store to be loaded in the Crypto instance.
 void setKeyStorePassword(String password)
          Sets the key store password.
 void setKeyStoreProvider(String provider)
          Sets the key store provider.
 void setKeyStoreType(String type)
          Sets the key store type.
 void setTrustStorePassword(String password)
          Sets the trust store password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CryptoFactoryBean

public CryptoFactoryBean()
Method Detail

setConfiguration

public void setConfiguration(Properties properties)
Sets the configuration of the Crypto. Setting this property overrides all previously set configuration, through the type-safe properties

See Also:
CryptoFactory.getInstance(java.util.Properties)

setCryptoProvider

public void setCryptoProvider(Class<? extends Crypto> cryptoProviderClass)
Sets the Crypto provider name. Defaults to Merlin.

This property maps to the WSS4J org.apache.ws.security.crypto.provider property.

Parameters:
cryptoProviderClass - the crypto provider class

setKeyStoreLocation

public void setKeyStoreLocation(Resource location)
                         throws IOException
Sets the location of the key store to be loaded in the Crypto instance.

This property maps to the WSS4J org.apache.ws.security.crypto.merlin.file property.

Parameters:
location - the key store location
Throws:
IOException - when the resource cannot be opened

setKeyStoreProvider

public void setKeyStoreProvider(String provider)
Sets the key store provider.

This property maps to the WSS4J org.apache.ws.security.crypto.merlin.keystore.provider property.

Parameters:
provider - the key store provider

setKeyStorePassword

public void setKeyStorePassword(String password)
Sets the key store password. Defaults to security.

This property maps to the WSS4J org.apache.ws.security.crypto.merlin.keystore.password property.

Parameters:
password - the key store password

setKeyStoreType

public void setKeyStoreType(String type)
Sets the key store type. Defaults to KeyStore.getDefaultType().

This property maps to the WSS4J org.apache.ws.security.crypto.merlin.keystore.type property.

Parameters:
type - the key store type

setTrustStorePassword

public void setTrustStorePassword(String password)
Sets the trust store password. Defaults to changeit.

WSS4J crypto uses the standard J2SE trust store, i.e. $JAVA_HOME/lib/security/cacerts.

This property maps to the WSS4J org.apache.ws.security.crypto.merlin.cacerts.password property.

Parameters:
password - the trust store password

setDefaultX509Alias

public void setDefaultX509Alias(String defaultX509Alias)
Sets the alias name of the default certificate which has been specified as a property. This should be the certificate that is used for signature and encryption. This alias corresponds to the certificate that should be used whenever KeyInfo is not present in a signed or an encrypted message.

This property maps to the WSS4J org.apache.ws.security.crypto.merlin.keystore.alias property.

Parameters:
defaultX509Alias - alias name of the default X509 certificate

setBeanClassLoader

public void setBeanClassLoader(ClassLoader classLoader)
Specified by:
setBeanClassLoader in interface BeanClassLoaderAware

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getObjectType

public Class<Crypto> getObjectType()
Specified by:
getObjectType in interface FactoryBean<Crypto>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<Crypto>

getObject

public Crypto getObject()
                 throws Exception
Specified by:
getObject in interface FactoryBean<Crypto>
Throws:
Exception

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.