Package com.adaptris.core.security
Class CoreSecurityService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.security.CoreSecurityService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
- Direct Known Subclasses:
DecryptionService,EncryptionService
public abstract class CoreSecurityService extends ServiceImp
The base class for all security services.- See Also:
SecurityService
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbranchingEnabled-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description CoreSecurityService()Creates a new Object with the following defaults.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddKeystoreUrl(ConfiguredKeystore url)Add an url to the list.protected voidcloseService()EncryptionAlgorithmgetEncryptionAlgorithm()Get the encryption algorithm to be used.java.lang.StringgetFailId()java.util.List<ConfiguredKeystore>getKeystoreUrls()Get the list of keystore urls.java.lang.StringgetLocalPartner()Get the local partner keystore alias.PrivateKeyPasswordProvidergetPrivateKeyPasswordProvider()java.lang.StringgetRemotePartner()Get the remote partner alias.java.lang.StringgetRemotePartnerMetadataKey()SecurityServiceFactorygetSecurityFactory()Get the encryption type to be used.java.lang.StringgetSuccessId()protected voidinitService()booleanisBranching()Returns true if the implementation supports branching.voidprepare()Prepare for initialisation.voidsetEncryptionAlgorithm(EncryptionAlgorithm enc)Set the encryption algorithm to be used.voidsetFailId(java.lang.String s)voidsetKeystoreUrls(java.util.List<ConfiguredKeystore> list)Set the keystore urls.voidsetLocalPartner(java.lang.String s)Set the local partner keystore alias.voidsetPrivateKeyPasswordProvider(PrivateKeyPasswordProvider pkpp)Set the private key password provider.voidsetRemotePartner(java.lang.String s)Set the remote partner keystore alias.voidsetRemotePartnerMetadataKey(java.lang.String s)voidsetSecurityFactory(SecurityServiceFactory s)Set the type of encryption to be used.voidsetSuccessId(java.lang.String s)-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop
-
-
-
-
Method Detail
-
isBranching
public boolean isBranching()
Description copied from interface:ServiceReturns true if the implementation supports branching.
- Specified by:
isBranchingin interfaceService- Overrides:
isBranchingin classServiceImp- Returns:
- true if the implementation supports branching
- See Also:
ServiceImp.isBranching()
-
getKeystoreUrls
public java.util.List<ConfiguredKeystore> getKeystoreUrls()
Get the list of keystore urls.- Returns:
- the list of keystore urls.
-
setKeystoreUrls
public void setKeystoreUrls(java.util.List<ConfiguredKeystore> list)
Set the keystore urls.- Parameters:
list- the list of keystore urls.
-
addKeystoreUrl
public void addKeystoreUrl(ConfiguredKeystore url)
Add an url to the list.Valid URLS are in the form
[protocol]://[server]:[port]/[path]?keystoreType=[type]& keystorePassword=[password]- protocol - the protocol to use, e.g. http
- server - the server hosting the keystore
- port - the port through which the protocol will operate
- path - Path to the keystore
- type - The type of keystore to use (e.g. JKS)
- password - password to the keystore
An example would be
http://www.adaptris.com/my.ks?keystoreType=JKS& keystorePassword=ABCDEorfile://localhost/c:/my.ks?keystoreType=JKS& keystorePassword=ABCDEFor the purposes of security each of the keystores will be searched in turn for the matching partner information. Only the first matching partner will be used.
- Parameters:
url- an individual url- See Also:
getKeystoreUrls(),ConfiguredKeystore
-
setLocalPartner
public void setLocalPartner(java.lang.String s)
Set the local partner keystore alias.- Parameters:
s- the local partner
-
getLocalPartner
public java.lang.String getLocalPartner()
Get the local partner keystore alias.- Returns:
- the local partner
-
setRemotePartner
public void setRemotePartner(java.lang.String s)
Set the remote partner keystore alias.If this is not set, then it will be derived from metadata.
- Parameters:
s- the remote partner- See Also:
CoreConstants.SECURITY_REMOTE_PARTNER
-
getRemotePartner
public java.lang.String getRemotePartner()
Get the remote partner alias.- Returns:
- the remote partner.
-
setEncryptionAlgorithm
public void setEncryptionAlgorithm(EncryptionAlgorithm enc)
Set the encryption algorithm to be used.- Parameters:
enc- the encryption algorithm
-
getEncryptionAlgorithm
public EncryptionAlgorithm getEncryptionAlgorithm()
Get the encryption algorithm to be used.- Returns:
- the encryption algorithm
-
setSecurityFactory
public void setSecurityFactory(SecurityServiceFactory s)
Set the type of encryption to be used.- Parameters:
s- the encryption type.
-
getSecurityFactory
public SecurityServiceFactory getSecurityFactory()
Get the encryption type to be used.- Returns:
- the encryption type.
-
initService
protected final void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
getFailId
public java.lang.String getFailId()
- Returns:
- the failId
-
setFailId
public void setFailId(java.lang.String s)
- Parameters:
s- the failId to set
-
getSuccessId
public java.lang.String getSuccessId()
- Returns:
- the successId
-
setSuccessId
public void setSuccessId(java.lang.String s)
- Parameters:
s- the successId to set
-
getRemotePartnerMetadataKey
public java.lang.String getRemotePartnerMetadataKey()
-
setRemotePartnerMetadataKey
public void setRemotePartnerMetadataKey(java.lang.String s)
-
getPrivateKeyPasswordProvider
public PrivateKeyPasswordProvider getPrivateKeyPasswordProvider()
-
setPrivateKeyPasswordProvider
public void setPrivateKeyPasswordProvider(PrivateKeyPasswordProvider pkpp)
Set the private key password provider.- Parameters:
pkpp- the provider; default isLegacyPrivateKeyPasswordProviderwhich retrieves the private key password from 'security.properties' on the classpath to support backward compatibility.
-
-