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 boolean
branchingEnabled
-
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 void
addKeystoreUrl(ConfiguredKeystore url)
Add an url to the list.protected void
closeService()
EncryptionAlgorithm
getEncryptionAlgorithm()
Get the encryption algorithm to be used.java.lang.String
getFailId()
java.util.List<ConfiguredKeystore>
getKeystoreUrls()
Get the list of keystore urls.java.lang.String
getLocalPartner()
Get the local partner keystore alias.PrivateKeyPasswordProvider
getPrivateKeyPasswordProvider()
java.lang.String
getRemotePartner()
Get the remote partner alias.java.lang.String
getRemotePartnerMetadataKey()
SecurityServiceFactory
getSecurityFactory()
Get the encryption type to be used.java.lang.String
getSuccessId()
protected void
initService()
boolean
isBranching()
Returns true if the implementation supports branching.void
prepare()
Prepare for initialisation.void
setEncryptionAlgorithm(EncryptionAlgorithm enc)
Set the encryption algorithm to be used.void
setFailId(java.lang.String s)
void
setKeystoreUrls(java.util.List<ConfiguredKeystore> list)
Set the keystore urls.void
setLocalPartner(java.lang.String s)
Set the local partner keystore alias.void
setPrivateKeyPasswordProvider(PrivateKeyPasswordProvider pkpp)
Set the private key password provider.void
setRemotePartner(java.lang.String s)
Set the remote partner keystore alias.void
setRemotePartnerMetadataKey(java.lang.String s)
void
setSecurityFactory(SecurityServiceFactory s)
Set the type of encryption to be used.void
setSuccessId(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:Service
Returns true if the implementation supports branching.
- Specified by:
isBranching
in interfaceService
- Overrides:
isBranching
in 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=ABCDE
orfile://localhost/c:/my.ks?keystoreType=JKS& keystorePassword=ABCDE
For 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:
initService
in classServiceImp
- Throws:
CoreException
-
closeService
protected void closeService()
- Specified by:
closeService
in classServiceImp
-
prepare
public void prepare() throws CoreException
Description copied from interface:ComponentLifecycleExtension
Prepare 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 isLegacyPrivateKeyPasswordProvider
which retrieves the private key password from 'security.properties' on the classpath to support backward compatibility.
-
-