diff options
author | Ade Lee <alee@redhat.com> | 2011-12-07 16:58:12 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2011-12-07 16:58:12 -0500 |
commit | 32150d3ee32f8ac27118af7c792794b538c78a2f (patch) | |
tree | 52dd96f664a6fa51be25b28b6f10adc5f2c9f660 /pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java | |
parent | f05d58a46795553beb8881039cc922974b40db34 (diff) | |
download | pki-32150d3ee32f8ac27118af7c792794b538c78a2f.tar.gz pki-32150d3ee32f8ac27118af7c792794b538c78a2f.tar.xz pki-32150d3ee32f8ac27118af7c792794b538c78a2f.zip |
Formatting
Formatted project according to eclipse project settings
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java')
-rw-r--r-- | pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java | 99 |
1 files changed, 47 insertions, 52 deletions
diff --git a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java index b8cc06f77..8b7a1dbe8 100644 --- a/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java +++ b/pki/base/common/src/com/netscape/cms/publish/mappers/LdapCertCompsMap.java @@ -17,7 +17,6 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cms.publish.mappers; - import java.security.cert.CRLException; import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; @@ -34,22 +33,19 @@ import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.publish.ILdapMapper; import com.netscape.certsrv.request.IRequest; - -/** - * Maps a X509 certificate to a LDAP entry using AVAs in the certificate's - * subject name to form the ldap search dn and filter. - * Takes a optional root search dn. - * The DN comps are used to form a LDAP entry to begin a subtree search. - * The filter comps are used to form a search filter for the subtree. - * If none of the DN comps matched, baseDN is used for the subtree. - * If the baseDN is null and none of the DN comps matched, it is an error. - * If none of the DN comps and filter comps matched, it is an error. - * If just the filter comps is null, a base search is performed. - * +/** + * Maps a X509 certificate to a LDAP entry using AVAs in the certificate's + * subject name to form the ldap search dn and filter. Takes a optional root + * search dn. The DN comps are used to form a LDAP entry to begin a subtree + * search. The filter comps are used to form a search filter for the subtree. If + * none of the DN comps matched, baseDN is used for the subtree. If the baseDN + * is null and none of the DN comps matched, it is an error. If none of the DN + * comps and filter comps matched, it is an error. If just the filter comps is + * null, a base search is performed. + * * @version $Revision$, $Date$ */ -public class LdapCertCompsMap - extends LdapDNCompsMap implements ILdapMapper { +public class LdapCertCompsMap extends LdapDNCompsMap implements ILdapMapper { ILogger mLogger = CMS.getLogger(); public LdapCertCompsMap() { @@ -57,22 +53,22 @@ public class LdapCertCompsMap // via configuration } - /** + /** * Constructor. - * - * The DN comps are used to form a LDAP entry to begin a subtree search. - * The filter comps are used to form a search filter for the subtree. - * If none of the DN comps matched, baseDN is used for the subtree. - * If the baseDN is null and none of the DN comps matched, it is an error. - * If none of the DN comps and filter comps matched, it is an error. - * If just the filter comps is null, a base search is performed. * - * @param baseDN The base DN. + * The DN comps are used to form a LDAP entry to begin a subtree search. The + * filter comps are used to form a search filter for the subtree. If none of + * the DN comps matched, baseDN is used for the subtree. If the baseDN is + * null and none of the DN comps matched, it is an error. If none of the DN + * comps and filter comps matched, it is an error. If just the filter comps + * is null, a base search is performed. + * + * @param baseDN The base DN. * @param dnComps Components to form the LDAP base dn for search. * @param filterComps Components to form the LDAP search filter. */ public LdapCertCompsMap(String baseDN, ObjectIdentifier[] dnComps, - ObjectIdentifier[] filterComps) { + ObjectIdentifier[] filterComps) { init(baseDN, dnComps, filterComps); } @@ -99,40 +95,35 @@ public class LdapCertCompsMap /** * constructor using non-standard certificate attribute. */ - public LdapCertCompsMap(String certAttr, String baseDN, - ObjectIdentifier[] dnComps, - ObjectIdentifier[] filterComps) { + public LdapCertCompsMap(String certAttr, String baseDN, + ObjectIdentifier[] dnComps, ObjectIdentifier[] filterComps) { super(certAttr, baseDN, dnComps, filterComps); } protected void init(String baseDN, ObjectIdentifier[] dnComps, - ObjectIdentifier[] filterComps) { + ObjectIdentifier[] filterComps) { super.init(baseDN, dnComps, filterComps); } /** - * Maps a certificate to LDAP entry. - * Uses DN components and filter components to form a DN and - * filter for a LDAP search. - * If the formed DN is null the baseDN will be used. - * If the formed DN is null and baseDN is null an error is thrown. - * If the filter is null a base search is performed. - * If both are null an error is thrown. + * Maps a certificate to LDAP entry. Uses DN components and filter + * components to form a DN and filter for a LDAP search. If the formed DN is + * null the baseDN will be used. If the formed DN is null and baseDN is null + * an error is thrown. If the filter is null a base search is performed. If + * both are null an error is thrown. * * @param conn - the LDAP connection. * @param obj - the X509Certificate. */ - public String - map(LDAPConnection conn, Object obj) - throws ELdapException { + public String map(LDAPConnection conn, Object obj) throws ELdapException { if (conn == null) return null; try { X509Certificate cert = (X509Certificate) obj; String result = null; // form dn and filter for search. - X500Name subjectDN = - (X500Name) ((X509Certificate) cert).getSubjectDN(); + X500Name subjectDN = (X500Name) ((X509Certificate) cert) + .getSubjectDN(); CMS.debug("LdapCertCompsMap: " + subjectDN.toString()); @@ -141,15 +132,16 @@ public class LdapCertCompsMap result = super.map(conn, subjectDN, certbytes); return result; } catch (CertificateEncodingException e) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_CANT_DECODE_CERT", e.toString())); - throw new ELdapException( - CMS.getUserMessage("CMS_LDAP_GET_DER_ENCODED_CERT_FAILED", e.toString())); + log(ILogger.LL_FAILURE, + CMS.getLogMessage("PUBLISH_CANT_DECODE_CERT", e.toString())); + throw new ELdapException(CMS.getUserMessage( + "CMS_LDAP_GET_DER_ENCODED_CERT_FAILED", e.toString())); } catch (ClassCastException e) { try { X509CRLImpl crl = (X509CRLImpl) obj; String result = null; - X500Name issuerDN = - (X500Name) ((X509CRLImpl) crl).getIssuerDN(); + X500Name issuerDN = (X500Name) ((X509CRLImpl) crl) + .getIssuerDN(); CMS.debug("LdapCertCompsMap: " + issuerDN.toString()); @@ -158,24 +150,27 @@ public class LdapCertCompsMap result = super.map(conn, issuerDN, crlbytes); return result; } catch (CRLException ex) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_CANT_DECODE_CRL", ex.toString())); - throw new ELdapException(CMS.getUserMessage("CMS_LDAP_GET_DER_ENCODED_CRL_FAILED", ex.toString())); + log(ILogger.LL_FAILURE, + CMS.getLogMessage("PUBLISH_CANT_DECODE_CRL", + ex.toString())); + throw new ELdapException(CMS.getUserMessage( + "CMS_LDAP_GET_DER_ENCODED_CRL_FAILED", ex.toString())); } catch (ClassCastException ex) { - log(ILogger.LL_FAILURE, CMS.getLogMessage("PUBLISH_NOT_SUPPORTED_OBJECT")); + log(ILogger.LL_FAILURE, + CMS.getLogMessage("PUBLISH_NOT_SUPPORTED_OBJECT")); return null; } } } public String map(LDAPConnection conn, IRequest req, Object obj) - throws ELdapException { + throws ELdapException { return map(conn, obj); } private void log(int level, String msg) { mLogger.log(ILogger.EV_SYSTEM, ILogger.S_LDAP, level, - "LdapCertCompsMap: " + msg); + "LdapCertCompsMap: " + msg); } } - |