org.jboss.security.plugins
Class JaasSecurityDomain

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.security.plugins.JaasSecurityManager (src) 
              extended byorg.jboss.security.plugins.JaasSecurityDomain
All Implemented Interfaces:
AuthenticationManager (src) , JaasSecurityDomainMBean (src) , MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , RealmMapping (src) , SecurityDomain (src) , Service (src) , ServiceMBean (src) , SubjectSecurityManager (src)

public class JaasSecurityDomain
extends JaasSecurityManager (src)
implements SecurityDomain (src) , JaasSecurityDomainMBean (src)

The JaasSecurityDomain is an extension of JaasSecurityManager that addes the notion of a KeyStore, and JSSE KeyManagerFactory and TrustManagerFactory for supporting SSL and other cryptographic use cases. Attributes:


Nested Class Summary
 
Nested classes inherited from class org.jboss.security.plugins.JaasSecurityManager (src)
JaasSecurityManager.DomainInfo (src)
 
Field Summary
 
Fields inherited from class org.jboss.security.plugins.JaasSecurityManager (src)
log, trace
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JaasSecurityDomain()
          Creates a default JaasSecurityDomain for with a securityDomain name of 'other'.
JaasSecurityDomain(java.lang.String securityDomain)
          Creates a JaasSecurityDomain for with a securityDomain name of that given by the 'securityDomain' argument.
JaasSecurityDomain(java.lang.String securityDomain, javax.security.auth.callback.CallbackHandler handler)
          Creates a JaasSecurityDomain for with a securityDomain name of that given by the 'securityDomain' argument.
 
Method Summary
 byte[] decode(byte[] secret)
          Decrypt the secret using the cipherKey.
 byte[] decode64(java.lang.String secret)
          Decrypt the base64 encoded secret using the cipherKey.
 byte[] encode(byte[] secret)
          Encrypt the secret using the cipherKey.
 java.lang.String encode64(byte[] secret)
          Encrypt the secret using the cipherKey and return a base64 encoding.
 java.lang.String getCipherAlgorithm()
           
 javax.net.ssl.KeyManagerFactory getKeyManagerFactory()
          Get the KeyManagerFactory associated with the security domain
 java.security.KeyStore getKeyStore()
          Get the keystore associated with the security domain
 java.lang.String getKeyStoreType()
          KeyStore implementation type being used.
 java.lang.String getKeyStoreURL()
          Get the KeyStore database URL string.
 ObjectName (src) getManagerServiceName()
          The JMX object name string of the security manager service.
 java.lang.String getName()
          Use the short class name as the default for the service name.
 javax.net.ssl.TrustManagerFactory getTrustManagerFactory()
          Get the TrustManagerFactory associated with the security domain
 java.security.KeyStore getTrustStore()
          Get the truststore associated with the security domain.
 java.lang.String getTrustStoreType()
          Get the type of the trust store
 java.lang.String getTrustStoreURL()
          Get the trust store database URL string.
 void reloadKeyAndTrustStore()
          Reload the key- and truststore
 void setCipherAlgorithm(java.lang.String cipherAlgorithm)
           
 void setIterationCount(int iterationCount)
          Set the iteration count used with PBE based on the keystore password.
 void setKeyStorePass(java.lang.String password)
          Set the credential string for the KeyStore.
 void setKeyStoreType(java.lang.String type)
          Set the type of KeyStore implementation to use.
 void setKeyStoreURL(java.lang.String storeURL)
          Set the KeyStore database URL string.
 void setManagerServiceName(ObjectName (src)  managerServiceName)
          Set the JMX object name string of the security manager service.
 void setSalt(java.lang.String salt)
          Set the salt used with PBE based on the keystore password.
 void setTrustStorePass(java.lang.String password)
          Set the credential string for the trust store.
 void setTrustStoreType(java.lang.String type)
          Set the type of the trust store
 void setTrustStoreURL(java.lang.String storeURL)
          Set the trust store database URL string.
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.security.plugins.JaasSecurityManager (src)
doesRoleGroupHaveRole, doesUserHaveRole, doesUserHaveRole, flushCache, getActiveSubject, getPrincipal, getSecurityDomain, getUserRoles, isValid, isValid, setCachePolicy
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.security.AuthenticationManager (src)
getActiveSubject, getSecurityDomain, isValid, isValid
 
Methods inherited from interface org.jboss.security.RealmMapping (src)
doesUserHaveRole, getPrincipal, getUserRoles
 
Methods inherited from interface org.jboss.system.ServiceMBean (src)
getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service (src)
create, destroy, start, stop
 

Constructor Detail

JaasSecurityDomain

public JaasSecurityDomain()
Creates a default JaasSecurityDomain for with a securityDomain name of 'other'.


JaasSecurityDomain

public JaasSecurityDomain(java.lang.String securityDomain)
Creates a JaasSecurityDomain for with a securityDomain name of that given by the 'securityDomain' argument.

Parameters:
securityDomain - , the name of the security domain

JaasSecurityDomain

public JaasSecurityDomain(java.lang.String securityDomain,
                          javax.security.auth.callback.CallbackHandler handler)
Creates a JaasSecurityDomain for with a securityDomain name of that given by the 'securityDomain' argument.

Parameters:
securityDomain - , the name of the security domain
handler - , the CallbackHandler to use to obtain login module info
Method Detail

getKeyStore

public java.security.KeyStore getKeyStore()
                                   throws java.lang.SecurityException
Description copied from interface: SecurityDomain (src)
Get the keystore associated with the security domain

Specified by:
getKeyStore in interface SecurityDomain (src)
Throws:
java.lang.SecurityException

getKeyManagerFactory

public javax.net.ssl.KeyManagerFactory getKeyManagerFactory()
                                                     throws java.lang.SecurityException
Description copied from interface: SecurityDomain (src)
Get the KeyManagerFactory associated with the security domain

Specified by:
getKeyManagerFactory in interface SecurityDomain (src)
Throws:
java.lang.SecurityException

getTrustStore

public java.security.KeyStore getTrustStore()
                                     throws java.lang.SecurityException
Description copied from interface: SecurityDomain (src)
Get the truststore associated with the security domain. This may be the same as the keystore.

Specified by:
getTrustStore in interface SecurityDomain (src)
Throws:
java.lang.SecurityException

getTrustManagerFactory

public javax.net.ssl.TrustManagerFactory getTrustManagerFactory()
                                                         throws java.lang.SecurityException
Description copied from interface: SecurityDomain (src)
Get the TrustManagerFactory associated with the security domain

Specified by:
getTrustManagerFactory in interface SecurityDomain (src)
Throws:
java.lang.SecurityException

getManagerServiceName

public ObjectName (src)  getManagerServiceName()
The JMX object name string of the security manager service.

Specified by:
getManagerServiceName in interface JaasSecurityDomainMBean (src)
Returns:
The JMX object name string of the security manager service.

setManagerServiceName

public void setManagerServiceName(ObjectName (src)  managerServiceName)
Set the JMX object name string of the security manager service.

Specified by:
setManagerServiceName in interface JaasSecurityDomainMBean (src)

getKeyStoreType

public java.lang.String getKeyStoreType()
Description copied from interface: JaasSecurityDomainMBean (src)
KeyStore implementation type being used.

Specified by:
getKeyStoreType in interface JaasSecurityDomainMBean (src)
Returns:
the KeyStore implementation type being used.

setKeyStoreType

public void setKeyStoreType(java.lang.String type)
Description copied from interface: JaasSecurityDomainMBean (src)
Set the type of KeyStore implementation to use. This is passed to the KeyStore.getInstance() factory method.

Specified by:
setKeyStoreType in interface JaasSecurityDomainMBean (src)

getKeyStoreURL

public java.lang.String getKeyStoreURL()
Description copied from interface: JaasSecurityDomainMBean (src)
Get the KeyStore database URL string.

Specified by:
getKeyStoreURL in interface JaasSecurityDomainMBean (src)

setKeyStoreURL

public void setKeyStoreURL(java.lang.String storeURL)
                    throws java.io.IOException
Description copied from interface: JaasSecurityDomainMBean (src)
Set the KeyStore database URL string. This is used to obtain an InputStream to initialize the KeyStore.

Specified by:
setKeyStoreURL in interface JaasSecurityDomainMBean (src)
Throws:
java.io.IOException

setKeyStorePass

public void setKeyStorePass(java.lang.String password)
Description copied from interface: JaasSecurityDomainMBean (src)
Set the credential string for the KeyStore.

Specified by:
setKeyStorePass in interface JaasSecurityDomainMBean (src)

getTrustStoreType

public java.lang.String getTrustStoreType()
Description copied from interface: JaasSecurityDomainMBean (src)
Get the type of the trust store

Specified by:
getTrustStoreType in interface JaasSecurityDomainMBean (src)
Returns:
the type of the trust store

setTrustStoreType

public void setTrustStoreType(java.lang.String type)
Description copied from interface: JaasSecurityDomainMBean (src)
Set the type of the trust store

Specified by:
setTrustStoreType in interface JaasSecurityDomainMBean (src)
Parameters:
type - - the trust store implementation type

setTrustStorePass

public void setTrustStorePass(java.lang.String password)
Description copied from interface: JaasSecurityDomainMBean (src)
Set the credential string for the trust store.

Specified by:
setTrustStorePass in interface JaasSecurityDomainMBean (src)

getTrustStoreURL

public java.lang.String getTrustStoreURL()
Description copied from interface: JaasSecurityDomainMBean (src)
Get the trust store database URL string.

Specified by:
getTrustStoreURL in interface JaasSecurityDomainMBean (src)

setTrustStoreURL

public void setTrustStoreURL(java.lang.String storeURL)
                      throws java.io.IOException
Description copied from interface: JaasSecurityDomainMBean (src)
Set the trust store database URL string. This is used to obtain an InputStream to initialize the trust store.

Specified by:
setTrustStoreURL in interface JaasSecurityDomainMBean (src)
Throws:
java.io.IOException

setSalt

public void setSalt(java.lang.String salt)
Description copied from interface: JaasSecurityDomainMBean (src)
Set the salt used with PBE based on the keystore password.

Specified by:
setSalt in interface JaasSecurityDomainMBean (src)
Parameters:
salt - - an 8 char randomization string

setIterationCount

public void setIterationCount(int iterationCount)
Description copied from interface: JaasSecurityDomainMBean (src)
Set the iteration count used with PBE based on the keystore password.

Specified by:
setIterationCount in interface JaasSecurityDomainMBean (src)
Parameters:
iterationCount - - an iteration count randomization value

getCipherAlgorithm

public java.lang.String getCipherAlgorithm()

setCipherAlgorithm

public void setCipherAlgorithm(java.lang.String cipherAlgorithm)

getName

public java.lang.String getName()
Description copied from class: ServiceMBeanSupport (src)
Use the short class name as the default for the service name.

Specified by:
getName in interface ServiceMBean (src)
Overrides:
getName in class ServiceMBeanSupport (src)

encode

public byte[] encode(byte[] secret)
              throws java.lang.Exception
Encrypt the secret using the cipherKey.

Specified by:
encode in interface JaasSecurityDomainMBean (src)
Parameters:
secret - - the plaintext secret to encrypt
Returns:
the encrypted secret
Throws:
java.lang.Exception

decode

public byte[] decode(byte[] secret)
              throws java.lang.Exception
Decrypt the secret using the cipherKey.

Specified by:
decode in interface JaasSecurityDomainMBean (src)
Parameters:
secret - - the encrypted secret to decrypt.
Returns:
the decrypted secret
Throws:
java.lang.Exception

encode64

public java.lang.String encode64(byte[] secret)
                          throws java.lang.Exception
Encrypt the secret using the cipherKey and return a base64 encoding.

Specified by:
encode64 in interface JaasSecurityDomainMBean (src)
Parameters:
secret - - the plaintext secret to encrypt
Returns:
the encrypted secret as a base64 string
Throws:
java.lang.Exception

decode64

public byte[] decode64(java.lang.String secret)
                throws java.lang.Exception
Decrypt the base64 encoded secret using the cipherKey.

Specified by:
decode64 in interface JaasSecurityDomainMBean (src)
Parameters:
secret - - the base64 encoded encrypted secret to decrypt.
Returns:
the decrypted secret
Throws:
java.lang.Exception

reloadKeyAndTrustStore

public void reloadKeyAndTrustStore()
                            throws java.lang.Exception
Reload the key- and truststore

Specified by:
reloadKeyAndTrustStore in interface JaasSecurityDomainMBean (src)
Throws:
java.lang.Exception

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

protected void stopService()
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)