Package javax.naming

Examples of javax.naming.NameParser


  }


  private String containsName(DirContext ctx, Attribute attr, String dn) throws NamingException, OperationFailedException
  {
    NameParser parser = ctx.getNameParser(realm.getPrefix());
    Name name = parser.parse(dn);
   
    for (NamingEnumeration e=attr.getAll(); e.hasMore(); ) {
      String cand = (String)e.next();
      Name candName = parser.parse(cand);
     
      if ( name.equals(candName) ) {
        e.close();
        return cand;
      }
View Full Code Here


         if (methodName.equals("toString") == true)
            return "Client ENC(" + clientName + ")";

         if (methodName.equals("lookup") == false)
            throw new OperationNotSupportedException("Only lookup is supported, op=" + method);
         NameParser parser = lookupCtx.getNameParser("");
         Name name = null;
         if (args[0] instanceof String)
            name = parser.parse((String) args[0]);
         else
            name = (Name) args[0];

         // Check for special objects not in the env
         if (name.size() < 2 || "java:comp".equals(name.get(0)) == false || "env".equals(name.get(1)) == false)
View Full Code Here

   level operations here.
    */
   public Object invoke(Object obj, Method method, Object[] args) throws Throwable
   {
      Context ctx = new InitialContext();
      NameParser parser = ctx.getNameParser("");
      String securityDomain = null;
      Name name = null;
     
     
      String methodName = method.getName();
      if( methodName.equals("toString") == true )
         return SecurityConstants.JAAS_CONTEXT_ROOT + " Context proxy";

      if( methodName.equals("list") == true )
         return new DomainEnumeration(JNDIBasedSecurityManagement.securityMgrMap.keys(),
               JNDIBasedSecurityManagement.securityMgrMap);
     
      if(methodName.equals("bind") || methodName.equals("rebind"))
      {
         if( args[0] instanceof String )
            name = parser.parse((String) args[0]);
         else
            name = (Name)args[0];
         securityDomain = name.get(0);
         SecurityDomainContext val = (SecurityDomainContext)args[1];
         JNDIBasedSecurityManagement.securityMgrMap.put(securityDomain, val);
         return obj;
      }
      if( methodName.equals("lookup") == false )
         throw new OperationNotSupportedException("Only lookup is supported, op="+method);
      if( args[0] instanceof String )
         name = parser.parse((String) args[0]);
      else
         name = (Name)args[0];
      securityDomain = name.get(0);
      SecurityDomainContext securityDomainCtx = lookupSecurityDomain(securityDomain);
      //TODO: Legacy expectation was subjectsecuritymgr
View Full Code Here

    String userDN = super.bindDNAuthentication(ctx, user, credential,
        searchBaseDN, filter);

    Attributes attrs = ctx.getAttributes(userDN, null);

    NameParser nameParser = ctx.getNameParser(userDN);

    UserPrincipal userPrincipal = (UserPrincipal) getIdentity();

    for (Map.Entry<String, String> option : ((Map<String, String>) options)
        .entrySet()) {
View Full Code Here

    public Configuration build( final Context context ) throws NamingException
    {
        final DefaultConfiguration configuration;

        final String absoluteName = context.getNameInNamespace();
        final NameParser parser = context.getNameParser( absoluteName );
        final Name parsedName = parser.parse( absoluteName );

        String name = absoluteName;
        String prefix = "";
        //if composite name, use only the relative name.
        final int position = parsedName.size();
View Full Code Here

            SearchResult result = (SearchResult) results.next();

            if (results.hasMore()) {
                //ignore for now
            }
            NameParser parser = context.getNameParser("");
            Name contextName = parser.parse(context.getNameInNamespace());
            Name baseName = parser.parse(userBase);
            Name entryName = parser.parse(result.getName());
            Name name = contextName.addAll(baseName);
            name = name.addAll(entryName);
            String dn = name.toString();

            Attributes attrs = result.getAttributes();
View Full Code Here

              user = new JSONObject();
              // Since UID is unique across the entire directory,
              // the search results should contain only one entry.
              SearchResult sr = (SearchResult) results.next();
              // we need the DN to authenticate the user
              NameParser parser = ctx.getNameParser(BASE);
          Name userDN = parser.parse(BASE);

          if (userDN == (Name) null)
          // This should not happen in theory
          throw new NameNotFoundException();
          else
          userDN.addAll(parser.parse(sr.getName()));
          user.put("userDN", userDN.toString());
                   
              // Get all available attribute types and their associated values.
          // we can build a user object to return.
              Attributes attributes = sr.getAttributes();
View Full Code Here

                containerLog.info("username " + username + " has multiple entries");
            return (null);
        }

        // Get the entry's distinguished name
        NameParser parser = context.getNameParser("");
        Name contextName = parser.parse(context.getNameInNamespace());
        Name baseName = parser.parse(userBase);

        // Bugzilla 32269
        Name entryName = parser.parse(new CompositeName(result.getName()).get(0));

        Name name = contextName.addAll(baseName);
        name = name.addAll(entryName);
        String dn = name.toString();
View Full Code Here

     *
     * @see javax.naming.Context#getNameParser(java.lang.String)
     */
    public NameParser getNameParser( String name ) throws NamingException
    {
        return new NameParser()
        {
            public Name parse( String name ) throws NamingException
            {
                try
                {
View Full Code Here

     *
     * @see javax.naming.Context#getNameParser(javax.naming.Name)
     */
    public NameParser getNameParser( final Name name ) throws NamingException
    {
        return new NameParser()
        {
            public Name parse( String n ) throws NamingException
            {
                try
                {
View Full Code Here

TOP

Related Classes of javax.naming.NameParser

Copyright © 2018 www.massapicom. 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.