Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
90 righe
2.9 KiB
90 righe
2.9 KiB
/* */package it.tref.signextractor.util; |
|
|
|
/* */ |
|
/* */import it.tref.signextractor.data.SignDN; |
|
|
|
/* */ |
|
import java.util.ArrayList; |
|
/* */ |
|
import java.util.List; |
|
|
|
/* */ |
|
import javax.naming.InvalidNameException; |
|
/* */ |
|
import javax.naming.ldap.LdapName; |
|
/* */ |
|
import javax.naming.ldap.Rdn; |
|
|
|
/* */ |
|
/* */public class SignDNUtil |
|
/* */{ |
|
/* */private static final String LDAP_COMMON_NAME = "CN"; |
|
/* */private static final String LDAP_COUNTRY = "C"; |
|
/* */private static final String LDAP_DOMAIN_NAME = "DN"; |
|
/* */private static final String LDAP_GIVENNAME = "GIVENNAME"; |
|
/* */private static final String LDAP_ORGANIZATION = "O"; |
|
/* */private static final String LDAP_SERIAL_NUMBER = "SERIALNUMBER"; |
|
/* */private static final String LDAP_SURNAME = "SURNAME"; |
|
/* */private static final String LDAP_USER_ORGANIZATION = "OU"; |
|
|
|
/* */ |
|
/* */public static SignDN getSignDN(String dn) |
|
/* */throws InvalidNameException |
|
/* */{ |
|
/* 24 */return getSignDN(dn, new SignDN()); |
|
/* */} |
|
|
|
/* */ |
|
/* */public static SignDN getSignDN(String dn, SignDN signDN) throws InvalidNameException { |
|
/* 28 */dn = cleanDN(dn); |
|
/* */ |
|
/* 30 */LdapName name = new LdapName(dn); |
|
/* */ |
|
/* 32 */List organizations = new ArrayList(); |
|
/* 33 */List userOrganizations = new ArrayList(); |
|
/* 34 */List others = new ArrayList(); |
|
/* */ |
|
/* 36 */List<Rdn> rdns = name.getRdns(); |
|
/* 37 */for (Rdn rdn : rdns) { |
|
/* 38 */String type = rdn.getType(); |
|
/* 39 */String value = (String) rdn.getValue(); |
|
/* */ |
|
/* 41 */if (type.equals("C")) |
|
/* 42 */signDN.setCountry(value); |
|
/* 43 */else if (type.equals("O")) |
|
/* 44 */organizations.add(value); |
|
/* 45 */else if (type.equals("OU")) |
|
/* 46 */userOrganizations.add(value); |
|
/* 47 */else if (type.equals("CN")) |
|
/* 48 */signDN.setCommonName(value); |
|
/* 49 */else if (type.equals("GIVENNAME")) |
|
/* 50 */signDN.setGivenName(value); |
|
/* 51 */else if (type.equals("SURNAME")) |
|
/* 52 */signDN.setSurName(value); |
|
/* 53 */else if (type.equals("SERIALNUMBER")) |
|
/* 54 */signDN.setSerialNumber(value); |
|
/* 55 */else if (type.equals("DN")) |
|
/* 56 */signDN.setDomainName(value); |
|
/* */else { |
|
/* 58 */others.add(value); |
|
/* */} |
|
/* */} |
|
/* 61 */signDN.setOrganizations(organizations); |
|
/* 62 */signDN.setUserOrganizations(userOrganizations); |
|
/* 63 */signDN.setOthers(others); |
|
/* */ |
|
/* 65 */return signDN; |
|
/* */} |
|
|
|
/* */ |
|
/* */private static String cleanDN(String dn) { |
|
/* 69 */return dn.replaceAll("\\+", ","); |
|
/* */} |
|
/* */ |
|
} |
|
|
|
/* |
|
* Location: |
|
* C:\liferay-sviluppo\portos2\git\portos-camel-document-processor\lib\tref-sign-exctractor |
|
* -0.1.0.jar Qualified Name: it.tref.signextractor.util.SignDNUtil JD-Core Version: 0.6.0 |
|
*/
|
|
|