Examples of DistinguishedName


Examples of org.apache.geronimo.security.deploy.DistinguishedName

                principalSet.add(principal);
                if (plainPrincipalInfo.isDesignatedRunAs()) roleDesignate.getPrincipals().add(principal);
            }

            for (Iterator names = role.getDistinguishedNames().iterator(); names.hasNext();) {
                DistinguishedName dn = (DistinguishedName) names.next();

                X500Principal x500Principal = ConfigurationUtil.generateX500Principal(dn.getName());

                principalSet.add(x500Principal);
                if (dn.isDesignatedRunAs()) roleDesignate.getPrincipals().add(x500Principal);
            }

            Set roleMapping = (Set) roleToPrincipalMap.get(roleName);
            if (roleMapping == null) {
                roleMapping = new HashSet();
View Full Code Here

Examples of org.ejbca.util.dn.DistinguishedName

                    final Map<String, String> dnMap = new HashMap<String, String>();
                    if (profile.getUse(DnComponents.DNEMAIL, 0)) {
                        dnMap.put(DnComponents.DNEMAIL, userDataVO.getEmail());
                    }
                    try {
                        dn = (new DistinguishedName(userData.getSubjectDN())).mergeDN(new DistinguishedName(dn), true, dnMap).toString();
                    } catch (InvalidNameException e) {
                        log.debug("Invalid dn. We make it empty");
                        dn = "";
                    }
                }
                if (userData.getSubjectAltName() != null) {
                    final Map<String, String> dnMap = new HashMap<String, String>();
                    if (profile.getUse(DnComponents.RFC822NAME, 0)) {
                        dnMap.put(DnComponents.RFC822NAME, userDataVO.getEmail());
                    }
                    try {
                        // SubjectAltName is not mandatory so
                        if (altName == null) {
                            altName = "";
                        }
                        altName = (new DistinguishedName(userData.getSubjectAltName())).mergeDN(new DistinguishedName(altName), true, dnMap).toString();
                    } catch (InvalidNameException e) {
                        log.debug("Invalid altName. We make it empty");
                        altName = "";
                    }
                }
View Full Code Here

Examples of org.ejbca.util.dn.DistinguishedName

     * @param email entity email.
     * @return updated DN.
     */
    private static String mergeSubjectDnWithDefaultValues(String subjectDN, EndEntityProfile profile,
            String entityEmail) {
        DistinguishedName profiledn;
        DistinguishedName userdn;
        try {
          userdn = new DistinguishedName(subjectDN);
    } catch (InvalidNameException ine) {
      log.debug(subjectDN,ine);
      throw new RuntimeException(ine);
    }
        int numberofsubjectdnfields = profile.getSubjectDNFieldOrderLength();
        List rdnList = new ArrayList(numberofsubjectdnfields);
        int[] fielddata = null;
        String value;
        //Build profile's DN
        for (int i = 0; i < numberofsubjectdnfields; i++) {
          value=null;
      fielddata = profile.getSubjectDNFieldsInOrder(i);
      String parameter = DNFieldExtractor.getFieldComponent(
          DnComponents.profileIdToDnId(fielddata[EndEntityProfile.FIELDTYPE]),
          DNFieldExtractor.TYPE_SUBJECTDN);
      value = profile.getValue(fielddata[EndEntityProfile.FIELDTYPE], 0);
      if (value != null) {
        value = value.trim();
        if (!value.equals("")) {         
          try {
            parameter = StringUtils.replace(parameter, "=", "");
            rdnList.add(fielddata[EndEntityProfile.NUMBER],new Rdn(parameter,value));
          }catch(InvalidNameException ine) {
            log.debug("InvalidNameException while creating new Rdn with parameter "+ parameter + " and value " + value,ine);
            throw new RuntimeException(ine);
          }
         
        }
      }
    }
        profiledn = new DistinguishedName(rdnList);

        Map dnMap = new HashMap();
        if (profile.getUse(DnComponents.DNEMAIL, 0)) {
            dnMap.put(DnComponents.DNEMAIL, entityEmail);
        }
View Full Code Here

Examples of org.ejbca.util.dn.DistinguishedName

     * @param profile user associated profile.
     * @param email entity email field
     * @return updated subject alt name
     */
    private static String mergeSubjectAltNameWithDefaultValues(String subjectAltName, EndEntityProfile profile, String entityEmail) {
        DistinguishedName profileAltName;
        DistinguishedName userAltName;
        try {
          if(subjectAltName==null) {
            subjectAltName = "";
          }
          userAltName = new DistinguishedName(subjectAltName);
    } catch (InvalidNameException ine) {
      log.debug(subjectAltName,ine);
      throw new RuntimeException(ine);
    }
        int numberofsubjectAltNamefields = profile.getSubjectAltNameFieldOrderLength();
        List rdnList = new ArrayList(numberofsubjectAltNamefields);
        int[] fielddata = null;
        String value;
        //Build profile's Alt Name
        for (int i = 0; i < numberofsubjectAltNamefields; i++) {
          value=null;
      fielddata = profile.getSubjectAltNameFieldsInOrder(i);
      String parameter = DNFieldExtractor.getFieldComponent(
          DnComponents.profileIdToDnId(fielddata[EndEntityProfile.FIELDTYPE]),
          DNFieldExtractor.TYPE_SUBJECTALTNAME);
      value = profile.getValue(fielddata[EndEntityProfile.FIELDTYPE], 0);
      if (value != null) {
        value = value.trim();
        if (!value.equals("")) {         
          try {
            parameter = StringUtils.replace(parameter, "=", "");
            rdnList.add(fielddata[EndEntityProfile.NUMBER],new Rdn(parameter,value));
          }catch(InvalidNameException ine) {
            log.debug("InvalidNameException while creating new Rdn with parameter "+ parameter + " and value " + value,ine);
            throw new RuntimeException(ine);
          }
         
        }
      }
    }
        profileAltName = new DistinguishedName(rdnList);

        Map dnMap = new HashMap();
        if (profile.getUse(DnComponents.RFC822NAME, 0)) {
            dnMap.put(DnComponents.RFC822NAME, entityEmail);
        }
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

                    {
                        String value = (String) attribute.get(i);
                        if (containsDN && !StringUtils.isEmpty(value))
                        {
                            // ensure dn values are all always equally encoded so we can use values.contains(internalId)
                            value = new DistinguishedName(value).toCompactString();
                        }
                        attributes.add(value);
                    }
                    catch (NamingException e)
                    {
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

                attributes.add(a);
            }
        }
        if (entityId == null)
        {
            DistinguishedName name = new DistinguishedName(dn);           
            LdapRdn rdn = name.getLdapRdn(name.size()-1);
            if (rdn.getKey().equals(searchConfiguration.getLdapIdAttribute()))
            {
                entityId = rdn.getValue();
            }
            else
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

        if (baseDn.length() == 0) {
            return fullDn;
        }

        DistinguishedName base = new DistinguishedName(baseDn);
        DistinguishedName full = new DistinguishedName(fullDn);

        if(base.equals(full)) {
            return "";
        }

        Assert.isTrue(full.startsWith(base), "Full DN does not start with base DN");

        full.removeFirst(base);

        return full.toString();
    }
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

     * Gets the full dn of a name by prepending the name of the context it is relative to.
     * If the name already contains the base name, it is returned unaltered.
     */
    public static DistinguishedName getFullDn(DistinguishedName dn, Context baseCtx)
            throws NamingException {
        DistinguishedName baseDn = new DistinguishedName(baseCtx.getNameInNamespace());

        if(dn.contains(baseDn)) {
            return dn;
        }

        baseDn.append(dn);

        return baseDn;
    }
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

    /**
     * Assembles the Distinguished Name that should be used the given username.
     */
    public DistinguishedName buildDn(String username) {
        DistinguishedName dn = new DistinguishedName(userDnBase);

        dn.add(usernameAttribute, username);

        return dn;
    }
View Full Code Here

Examples of org.springframework.ldap.core.DistinguishedName

                public Object executeWithContext(DirContext ctx) throws NamingException {
                    Attributes attrs = ctx.getAttributes(dn, attributesToRetrieve);

                    // Object object = ctx.lookup(LdapUtils.getRelativeName(dn, ctx));

                    return new DirContextAdapter(attrs, new DistinguishedName(dn),
                            new DistinguishedName(ctx.getNameInNamespace()));
                }
            });
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.