com.sun.enterprise.security.ssl.impl
Class SecuritySupportImpl

java.lang.Object
  extended by com.sun.enterprise.server.pluggable.SecuritySupport
      extended by com.sun.enterprise.security.ssl.impl.SecuritySupportImpl

@Service
@Scoped(value=org.jvnet.hk2.component.Singleton.class)
public class SecuritySupportImpl
extends SecuritySupport

This implements SecuritySupport used in PluggableFeatureFactory.

Author:
Shing Wai Chan

Field Summary
protected static java.util.logging.Logger _logger
           
protected static boolean initialized
           
protected static java.util.List<char[]> keyStorePasswords
           
protected static java.util.List<java.security.KeyStore> keyStores
           
protected static java.util.List<java.lang.String> tokenNames
           
protected static java.util.List<java.security.KeyStore> trustStores
           
 
Fields inherited from class com.sun.enterprise.server.pluggable.SecuritySupport
KEYSTORE_PASS_PROP, KEYSTORE_TYPE_PROP, keyStoreProp, TRUSTSTORE_PASS_PROP, TRUSTSTORE_TYPE_PROP, trustStoreProp
 
Constructor Summary
  SecuritySupportImpl()
           
protected SecuritySupportImpl(boolean init)
           
 
Method Summary
 void checkPermission(java.lang.String key)
          Check permission for the given key.
 javax.net.ssl.KeyManager[] getKeyManagers(java.lang.String algorithm)
           
 java.security.KeyStore getKeyStore(java.lang.String token)
           
 java.security.KeyStore[] getKeyStores()
          This method returns an array of keystores containing keys and certificates.
 java.security.PrivateKey getPrivateKeyForAlias(java.lang.String alias, int keystoreIndex)
          Gets the PrivateKey for specified alias from the corresponding keystore indicated by the index.
 java.lang.String[] getTokenNames()
          This method returns an array of token names in order corresponding to array of keystores.
 javax.net.ssl.TrustManager[] getTrustManagers(java.lang.String algorithm)
           
 java.security.KeyStore getTrustStore(java.lang.String token)
           
 java.security.KeyStore[] getTrustStores()
          This method returns an array of truststores containing certificates.
 boolean isACC()
           
 boolean isNotServerORACC()
           
 java.security.KeyStore loadNullStore(java.lang.String type, int index)
           
protected static void loadStores(java.lang.String tokenName, java.security.Provider provider, java.lang.String keyStoreFile, char[] keyStorePass, java.lang.String keyStoreType, java.lang.String trustStoreFile, char[] trustStorePass, java.lang.String trustStoreType)
          This method will load keystore and truststore and add into corresponding list.
 void synchronizeKeyFile(java.lang.Object configContext, java.lang.String fileRealmName)
          TODO:V3:Cluster ConfigContext is no longer present so find out what this needs to be
 boolean verifyMasterPassword(char[] masterPass)
           
 
Methods inherited from class com.sun.enterprise.server.pluggable.SecuritySupport
getDefaultInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected static final java.util.logging.Logger _logger

initialized

protected static boolean initialized

keyStores

protected static final java.util.List<java.security.KeyStore> keyStores

trustStores

protected static final java.util.List<java.security.KeyStore> trustStores

keyStorePasswords

protected static final java.util.List<char[]> keyStorePasswords

tokenNames

protected static final java.util.List<java.lang.String> tokenNames
Constructor Detail

SecuritySupportImpl

public SecuritySupportImpl()

SecuritySupportImpl

protected SecuritySupportImpl(boolean init)
Method Detail

loadStores

protected static void loadStores(java.lang.String tokenName,
                                 java.security.Provider provider,
                                 java.lang.String keyStoreFile,
                                 char[] keyStorePass,
                                 java.lang.String keyStoreType,
                                 java.lang.String trustStoreFile,
                                 char[] trustStorePass,
                                 java.lang.String trustStoreType)
This method will load keystore and truststore and add into corresponding list.

Parameters:
tokenName -
provider -
keyStorePass -
keyStoreFile -
keyStoreType -
trustStorePass -
trustStoreFile -
trustStoreType -

getKeyStores

public java.security.KeyStore[] getKeyStores()
This method returns an array of keystores containing keys and certificates.

Specified by:
getKeyStores in class SecuritySupport

loadNullStore

public java.security.KeyStore loadNullStore(java.lang.String type,
                                            int index)
                                     throws java.security.KeyStoreException,
                                            java.io.IOException,
                                            java.security.NoSuchAlgorithmException,
                                            java.security.cert.CertificateException
Specified by:
loadNullStore in class SecuritySupport
Returns:
load a null keystore of given type.
Throws:
java.security.KeyStoreException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException

getKeyManagers

public javax.net.ssl.KeyManager[] getKeyManagers(java.lang.String algorithm)
                                          throws java.io.IOException,
                                                 java.security.KeyStoreException,
                                                 java.security.NoSuchAlgorithmException,
                                                 java.security.UnrecoverableKeyException
Specified by:
getKeyManagers in class SecuritySupport
Returns:
KeyManagers for the specified algorithm.
Throws:
java.io.IOException
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException

getTrustManagers

public javax.net.ssl.TrustManager[] getTrustManagers(java.lang.String algorithm)
                                              throws java.io.IOException,
                                                     java.security.KeyStoreException,
                                                     java.security.NoSuchAlgorithmException
Specified by:
getTrustManagers in class SecuritySupport
Returns:
TrustManagers for the specified algorithm.
Throws:
java.io.IOException
java.security.KeyStoreException
java.security.NoSuchAlgorithmException

getTrustStores

public java.security.KeyStore[] getTrustStores()
This method returns an array of truststores containing certificates.

Specified by:
getTrustStores in class SecuritySupport

verifyMasterPassword

public boolean verifyMasterPassword(char[] masterPass)
Specified by:
verifyMasterPassword in class SecuritySupport
Returns:
result whether the given master password is correct.

getTokenNames

public java.lang.String[] getTokenNames()
This method returns an array of token names in order corresponding to array of keystores.

Specified by:
getTokenNames in class SecuritySupport

getKeyStore

public java.security.KeyStore getKeyStore(java.lang.String token)
Specified by:
getKeyStore in class SecuritySupport
Parameters:
token -
Returns:
a keystore

getTrustStore

public java.security.KeyStore getTrustStore(java.lang.String token)
Specified by:
getTrustStore in class SecuritySupport
Parameters:
token -
Returns:
a truststore

synchronizeKeyFile

public void synchronizeKeyFile(java.lang.Object configContext,
                               java.lang.String fileRealmName)
                        throws java.lang.Exception
Description copied from class: SecuritySupport
TODO:V3:Cluster ConfigContext is no longer present so find out what this needs to be

Specified by:
synchronizeKeyFile in class SecuritySupport
Throws:
java.lang.Exception

checkPermission

public void checkPermission(java.lang.String key)
Description copied from class: SecuritySupport
Check permission for the given key.

Specified by:
checkPermission in class SecuritySupport

isACC

public boolean isACC()

isNotServerORACC

public boolean isNotServerORACC()

getPrivateKeyForAlias

public java.security.PrivateKey getPrivateKeyForAlias(java.lang.String alias,
                                                      int keystoreIndex)
                                               throws java.security.KeyStoreException,
                                                      java.security.NoSuchAlgorithmException,
                                                      java.security.UnrecoverableKeyException
Description copied from class: SecuritySupport
Gets the PrivateKey for specified alias from the corresponding keystore indicated by the index.

Specified by:
getPrivateKeyForAlias in class SecuritySupport
Parameters:
alias - Alias for which the PrivateKey is desired.
keystoreIndex - Index of the keystore.
Returns:
Throws:
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException


Copyright © 2012 GlassFish Community. All Rights Reserved.