com.sun.ebxml.registry.security.authentication
Class AuthenticationServiceImpl

java.lang.Object
  |
  +--com.sun.ebxml.registry.security.authentication.AuthenticationServiceImpl

public class AuthenticationServiceImpl
extends java.lang.Object

Manages authentication functionality for the registry. This includes managemnet of user public keys in the server key store.

Author:
Farrukh S. Najmi

Field Summary
static java.lang.String ALIAS_ADRIAN
           
static java.lang.String ALIAS_CY
           
static java.lang.String ALIAS_FARRUKH
           
static java.lang.String ALIAS_NIKOLA
           
static java.lang.String ALIAS_REGISTRY_GUEST
           
static java.lang.String ALIAS_REGISTRY_OPERATOR
           
 
Constructor Summary
protected AuthenticationServiceImpl()
           
 
Method Summary
 java.lang.String getAliasFromUser(org.oasis.ebxml.registry.bindings.rim.User user)
          Gets the alias within the KeyStore for a User
 java.security.cert.X509Certificate getCertificate(java.lang.String alias)
           
 java.security.cert.Certificate[] getCertificateChain(java.lang.String alias)
           
 java.security.cert.X509Certificate getCertificateFromUser(org.oasis.ebxml.registry.bindings.rim.User user)
          Gets the alias within the KeyStore for a User
static AuthenticationServiceImpl getInstance()
           
 java.security.KeyStore getKeyStore()
          Get the keystore whose path is specified by getKeyStoreFileName().
 java.lang.String getKeyStoreFileName()
           
 java.lang.String getKeyStorePassword()
           
 java.security.PrivateKey getPrivateKey(java.lang.String alias, java.lang.String password)
           
 java.security.KeyStore getTrustAnchorsKeyStore()
           
 org.oasis.ebxml.registry.bindings.rim.User getUserFromAlias(java.lang.String alias)
          Gets the User that is associated with the KeyInfo provided within the XMLSignature signature.
 org.oasis.ebxml.registry.bindings.rim.User getUserFromXMLSignature(org.apache.xml.security.signature.XMLSignature signature)
          Gets the User that is associated with the KeyInfo provided within the XMLSignature signature.
static void main(java.lang.String[] args)
           
protected  void registerUserCertificate(java.lang.String userId, org.apache.xml.security.signature.XMLSignature signature)
          Add a certificate entry in the keystore.
 void validateCertificate(org.apache.xml.security.signature.XMLSignature signature)
          Check if the signatures CA is trusted by the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIAS_REGISTRY_OPERATOR

public static java.lang.String ALIAS_REGISTRY_OPERATOR

ALIAS_REGISTRY_GUEST

public static java.lang.String ALIAS_REGISTRY_GUEST

ALIAS_FARRUKH

public static java.lang.String ALIAS_FARRUKH

ALIAS_NIKOLA

public static java.lang.String ALIAS_NIKOLA

ALIAS_CY

public static java.lang.String ALIAS_CY

ALIAS_ADRIAN

public static java.lang.String ALIAS_ADRIAN
Constructor Detail

AuthenticationServiceImpl

protected AuthenticationServiceImpl()
Method Detail

getTrustAnchorsKeyStore

public java.security.KeyStore getTrustAnchorsKeyStore()
                                               throws RegistryException
RegistryException

getKeyStore

public java.security.KeyStore getKeyStore()
                                   throws RegistryException
Get the keystore whose path is specified by getKeyStoreFileName(). Note that all the methods that access the keystore MUST access the keystore via this method. Do not access the keystore directly by accessing the keystore field. Otherwise the checking the write lock to keystore will be bypassed.

RegistryException

getPrivateKey

public java.security.PrivateKey getPrivateKey(java.lang.String alias,
                                              java.lang.String password)
                                       throws RegistryException
RegistryException

getCertificate

public java.security.cert.X509Certificate getCertificate(java.lang.String alias)
                                                  throws RegistryException
RegistryException

getCertificateChain

public java.security.cert.Certificate[] getCertificateChain(java.lang.String alias)
                                                     throws RegistryException
RegistryException

getInstance

public static AuthenticationServiceImpl getInstance()

getKeyStoreFileName

public java.lang.String getKeyStoreFileName()
                                     throws RegistryException
RegistryException

getKeyStorePassword

public java.lang.String getKeyStorePassword()
                                     throws RegistryException
RegistryException

validateCertificate

public void validateCertificate(org.apache.xml.security.signature.XMLSignature signature)
                         throws UserRegistrationException,
                                RegistryException
Check if the signatures CA is trusted by the registry.

Throws:
UserRegistrationException - if the certificate issuing CA is not trusted.
RegistryException - if the certificates cannot be verified for some other reasons, such as unable to load trust anchors keystore

getAliasFromUser

public java.lang.String getAliasFromUser(org.oasis.ebxml.registry.bindings.rim.User user)
                                  throws RegistryException
Gets the alias within the KeyStore for a User

RegistryException

getCertificateFromUser

public java.security.cert.X509Certificate getCertificateFromUser(org.oasis.ebxml.registry.bindings.rim.User user)
                                                          throws RegistryException
Gets the alias within the KeyStore for a User

RegistryException

getUserFromAlias

public org.oasis.ebxml.registry.bindings.rim.User getUserFromAlias(java.lang.String alias)
                                                            throws RegistryException
Gets the User that is associated with the KeyInfo provided within the XMLSignature signature.

Throws:
RegistryException - no matching User is found. May need more specific Exception??

getUserFromXMLSignature

public org.oasis.ebxml.registry.bindings.rim.User getUserFromXMLSignature(org.apache.xml.security.signature.XMLSignature signature)
                                                                   throws RegistryException
Gets the User that is associated with the KeyInfo provided within the XMLSignature signature.

Throws:
RegistryException - no matching User is found. May need more specific Exception??

registerUserCertificate

protected void registerUserCertificate(java.lang.String userId,
                                       org.apache.xml.security.signature.XMLSignature signature)
                                throws RegistryException
Add a certificate entry in the keystore.

Parameters:
userId - The alias of the certificate
signature - The XMLSignature containing the certificate
Throws:
UserRegistration - fails if the keystore already contrains the entry whose alias is equal to userId
RegistryException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
java.lang.Exception


Copyright © 2001-2003 OASIS. All Rights Reserved.