Package org.jboss.security
Class JBossJSSESecurityDomain
- java.lang.Object
-
- org.jboss.security.JBossJSSESecurityDomain
-
- All Implemented Interfaces:
BaseSecurityManager,JSSESecurityDomain
public class JBossJSSESecurityDomain extends Object implements JSSESecurityDomain
A security domain used to configure SSL.- Author:
- Marcus Moyses
-
-
Constructor Summary
Constructors Constructor Description JBossJSSESecurityDomain(String securityDomainName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PropertiesgetAdditionalProperties()Returns the additional properties mapCertificategetCertificate(String alias)Returns the certificate with the given alias or null if no such certificate exists, from the trust store this security domain delegates to.String[]getCipherSuites()Returns the cipher suites that should be enabled on SSLSocketsStringgetClientAlias()Get the preferred client alias nameKeygetKey(String alias, String serviceAuthToken)Returns the key with the given alias from the key store this security domain delegates to.StringgetKeyManagerFactoryAlgorithm()StringgetKeyManagerFactoryProvider()KeyManager[]getKeyManagers()Get the KeyManagers created by the configured KeyManagerFactoryKeyStoregetKeyStore()Get the keystore associated with the security domainStringgetKeyStoreProvider()StringgetKeyStoreProviderArgument()StringgetKeyStoreType()StringgetKeyStoreURL()String[]getProtocols()Returns the protocols that should be enabled on SSLSocketsStringgetSecurityDomain()Get the security domain from which the security manager is from.StringgetServerAlias()Get the preferred server alias nameStringgetTrustManagerFactoryAlgorithm()StringgetTrustManagerFactoryProvider()TrustManager[]getTrustManagers()Get the TrustManagers created by the configured TrustManagerFactoryKeyStoregetTrustStore()Get the truststore associated with the security domain.StringgetTrustStoreProvider()StringgetTrustStoreProviderArgument()StringgetTrustStoreType()StringgetTrustStoreURL()booleanisClientAuth()Get the client auth flagvoidreloadKeyAndTrustStore()Reload/initialize keystore and truststore using the attributes set in the security domainvoidsetAdditionalProperties(Properties properties)voidsetCipherSuites(String cipherSuites)voidsetClientAlias(String clientAlias)voidsetClientAuth(boolean clientAuth)voidsetKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)voidsetKeyManagerFactoryProvider(String keyManagerFactoryProvider)voidsetKeyStorePassword(String keyStorePassword)voidsetKeyStoreProvider(String keyStoreProvider)voidsetKeyStoreProviderArgument(String keyStoreProviderArgument)voidsetKeyStoreType(String keyStoreType)voidsetKeyStoreURL(String keyStoreURL)voidsetProtocols(String protocols)voidsetServerAlias(String serverAlias)voidsetServiceAuthToken(String serviceAuthToken)voidsetTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm)voidsetTrustManagerFactoryProvider(String trustManagerFactoryProvider)voidsetTrustStorePassword(String trustStorePassword)voidsetTrustStoreProvider(String trustStoreProvider)voidsetTrustStoreProviderArgument(String trustStoreProviderArgument)voidsetTrustStoreType(String trustStoreType)voidsetTrustStoreURL(String trustStoreURL)
-
-
-
Constructor Detail
-
JBossJSSESecurityDomain
public JBossJSSESecurityDomain(String securityDomainName)
-
-
Method Detail
-
getKeyStoreType
public String getKeyStoreType()
-
setKeyStoreType
public void setKeyStoreType(String keyStoreType)
-
getKeyStoreURL
public String getKeyStoreURL()
-
setKeyStoreURL
public void setKeyStoreURL(String keyStoreURL) throws IOException
- Throws:
IOException
-
getKeyStoreProvider
public String getKeyStoreProvider()
-
setKeyStoreProvider
public void setKeyStoreProvider(String keyStoreProvider)
-
getKeyManagerFactoryProvider
public String getKeyManagerFactoryProvider()
-
getKeyStoreProviderArgument
public String getKeyStoreProviderArgument()
-
setKeyStoreProviderArgument
public void setKeyStoreProviderArgument(String keyStoreProviderArgument)
-
setKeyManagerFactoryProvider
public void setKeyManagerFactoryProvider(String keyManagerFactoryProvider)
-
getKeyManagerFactoryAlgorithm
public String getKeyManagerFactoryAlgorithm()
-
setKeyManagerFactoryAlgorithm
public void setKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)
-
getTrustStoreType
public String getTrustStoreType()
-
setTrustStoreType
public void setTrustStoreType(String trustStoreType)
-
getTrustStoreURL
public String getTrustStoreURL()
-
setTrustStoreURL
public void setTrustStoreURL(String trustStoreURL) throws IOException
- Throws:
IOException
-
getTrustStoreProvider
public String getTrustStoreProvider()
-
setTrustStoreProvider
public void setTrustStoreProvider(String trustStoreProvider)
-
getTrustStoreProviderArgument
public String getTrustStoreProviderArgument()
-
setTrustStoreProviderArgument
public void setTrustStoreProviderArgument(String trustStoreProviderArgument)
-
getTrustManagerFactoryProvider
public String getTrustManagerFactoryProvider()
-
setTrustManagerFactoryProvider
public void setTrustManagerFactoryProvider(String trustManagerFactoryProvider)
-
getTrustManagerFactoryAlgorithm
public String getTrustManagerFactoryAlgorithm()
-
setTrustManagerFactoryAlgorithm
public void setTrustManagerFactoryAlgorithm(String trustManagerFactoryAlgorithm)
-
getClientAlias
public String getClientAlias()
Description copied from interface:JSSESecurityDomainGet the preferred client alias name- Specified by:
getClientAliasin interfaceJSSESecurityDomain- Returns:
- the preferred client alias, in case the underlying keystore contains multiple client aliases that can be used, and we wish to have more control over picking a specific one. Will return null if no preferred client alias is configured.
-
setClientAlias
public void setClientAlias(String clientAlias)
-
getServerAlias
public String getServerAlias()
Description copied from interface:JSSESecurityDomainGet the preferred server alias name- Specified by:
getServerAliasin interfaceJSSESecurityDomain- Returns:
- the preferred server alias, in case the underlying keystore contains multiple server aliases that can be used, and we wish to have more control over picking a specific one. Will return null if no preferred server alias is configured.
-
setServerAlias
public void setServerAlias(String serverAlias)
-
isClientAuth
public boolean isClientAuth()
Description copied from interface:JSSESecurityDomainGet the client auth flag- Specified by:
isClientAuthin interfaceJSSESecurityDomain- Returns:
- true to instruct callers into the implementations of this interface to require client authentication during the SSL handshake. If this flag is "true", the SSL handshake is supposed to fail if a client does not provide a valid certificate.
-
setClientAuth
public void setClientAuth(boolean clientAuth)
-
getKeyStore
public KeyStore getKeyStore()
Description copied from interface:JSSESecurityDomainGet the keystore associated with the security domain- Specified by:
getKeyStorein interfaceJSSESecurityDomain- Returns:
- the keystore
-
getTrustStore
public KeyStore getTrustStore()
Description copied from interface:JSSESecurityDomainGet the truststore associated with the security domain. This may be the same as the keystore- Specified by:
getTrustStorein interfaceJSSESecurityDomain- Returns:
- the truststore
-
setKeyStorePassword
public void setKeyStorePassword(String keyStorePassword) throws Exception
- Throws:
Exception
-
setTrustStorePassword
public void setTrustStorePassword(String trustStorePassword) throws Exception
- Throws:
Exception
-
setServiceAuthToken
public void setServiceAuthToken(String serviceAuthToken) throws Exception
- Throws:
Exception
-
getKeyManagers
public KeyManager[] getKeyManagers() throws SecurityException
Description copied from interface:JSSESecurityDomainGet the KeyManagers created by the configured KeyManagerFactory- Specified by:
getKeyManagersin interfaceJSSESecurityDomain- Returns:
- the initialized KeyManagers
- Throws:
SecurityException
-
getTrustManagers
public TrustManager[] getTrustManagers() throws SecurityException
Description copied from interface:JSSESecurityDomainGet the TrustManagers created by the configured TrustManagerFactory- Specified by:
getTrustManagersin interfaceJSSESecurityDomain- Returns:
- the initialized TrustManagers
- Throws:
SecurityException
-
getSecurityDomain
public String getSecurityDomain()
Description copied from interface:BaseSecurityManagerGet the security domain from which the security manager is from. Every security manager belongs to a named domain. The meaning of the security domain name depends on the implementation. Examples range from as fine grained as the name of EJBs to J2EE application names to DNS domain names.- Specified by:
getSecurityDomainin interfaceBaseSecurityManager- Returns:
- the security domain name. May be null in which case the security manager belongs to the logical default domain.
-
getKey
public Key getKey(String alias, String serviceAuthToken) throws Exception
Description copied from interface:JSSESecurityDomainReturns the key with the given alias from the key store this security domain delegates to. All keys except public keys require a service authentication token. In case of a public key the authentication token will be ignored, and it can be safely null.- Specified by:
getKeyin interfaceJSSESecurityDomain- Parameters:
alias- - the alias corresponding to the key to be retrieved.serviceAuthToken- - the authentication token that establishes whether the calling service has the permission to retrieve the key. If no authentication token provided, or invalid authentication token is provided, the method will throw SecurityException- Returns:
- the requested key, or null if the given alias does not exist or does not identify a key-related entry.
- Throws:
SecurityException- for missing or invalid serviceAuthToken.IllegalStateException- if sensitive information is requested, but no service authorization token is configured on security domain.Exception- See Also:
KeyStore.getKey(String, char[])
-
getCertificate
public Certificate getCertificate(String alias) throws Exception
Description copied from interface:JSSESecurityDomainReturns the certificate with the given alias or null if no such certificate exists, from the trust store this security domain delegates to.- Specified by:
getCertificatein interfaceJSSESecurityDomain- Parameters:
alias- - the alias corresponding to the certificate to be retrieved.- Returns:
- the requested certificate, or null if the given alias does not exist or does not identify a certificate-related entry.
- Throws:
Exception- See Also:
KeyStore.getKey(String, char[])
-
reloadKeyAndTrustStore
public void reloadKeyAndTrustStore() throws ExceptionDescription copied from interface:JSSESecurityDomainReload/initialize keystore and truststore using the attributes set in the security domain- Specified by:
reloadKeyAndTrustStorein interfaceJSSESecurityDomain- Throws:
Exception- if an error occurs
-
getCipherSuites
public String[] getCipherSuites()
Description copied from interface:JSSESecurityDomainReturns the cipher suites that should be enabled on SSLSockets- Specified by:
getCipherSuitesin interfaceJSSESecurityDomain- Returns:
- array of cipher suite names
-
setCipherSuites
public void setCipherSuites(String cipherSuites)
-
getProtocols
public String[] getProtocols()
Description copied from interface:JSSESecurityDomainReturns the protocols that should be enabled on SSLSockets- Specified by:
getProtocolsin interfaceJSSESecurityDomain- Returns:
- array of protocol names
-
setProtocols
public void setProtocols(String protocols)
-
getAdditionalProperties
public Properties getAdditionalProperties()
Description copied from interface:JSSESecurityDomainReturns the additional properties map- Specified by:
getAdditionalPropertiesin interfaceJSSESecurityDomain- Returns:
- map with additional properties
-
setAdditionalProperties
public void setAdditionalProperties(Properties properties)
-
-