Package net.jini.jeri.kerberos.KerberosUtil

Examples of net.jini.jeri.kerberos.KerberosUtil.Config


    outer:
      for (ConfigIter citer = new ConfigIter(
         clientPrincipals, serverPrincipal, canDeleg);
     citer.hasNext(); )
      {
    Config config = citer.next();
    for (Iterator jter = constraints.requirements().iterator();
         jter.hasNext(); )
    {
        InvocationConstraint c =
      (InvocationConstraint) jter.next();
        if (!KerberosUtil.isSatisfiable(config, c))
      continue outer;
    }
    configArr.add(config);
      }

      if (configArr.size() == 0) {
    errorCode = UNSATISFIABLE_CONSTRAINT_REQUIRED;
    detailedExceptionMsg = "Constraints unsatisfiable by this " +
        "endpoint with the current subject have been required: " +
        constraints + ", while the KerberosPrincipal set of " +
        "the subject is: " + subjectClientPrincipals;
    return;
      }

      configs = (Config[]) configArr.toArray(
    new Config[configArr.size()]);

      // reorder configs by the num of preferences a config can satisfy
      for (int i = 0; i < configs.length; i++) {
    for (Iterator iter = constraints.preferences().iterator();
         iter.hasNext(); )
          {
        InvocationConstraint c =
      (InvocationConstraint) iter.next();
        if (KerberosUtil.isSatisfiable(configs[i], c))
      configs[i].prefCount++;
    }
      }
      Arrays.sort(configs, new Comparator() {
        public int compare(Object o1, Object o2) {
      Config config1 = (Config) o1;
      Config config2 = (Config) o2;
      // sort to descending order by prefCount
      return config2.prefCount - config1.prefCount;
        }
    });
View Full Code Here


  // javadoc is inherited from the ConnectionEndpoint interface
  public Connection connect(OutboundRequestHandle handle)
      throws IOException
  {
      RequestHandleImpl rh = checkRequestHandleImpl(handle);
      Config config = null;
      Exception exceptionCaught = null;
      try {
    /* do permission and credential check, pick the config
       to be used */
    List configs = rh.getConfigs();
View Full Code Here

    return null; // the other connect will be called later
      }

      boolean checkedResolvePermission = false;
      for (Iterator i = configList.iterator(); i.hasNext(); ) {
    Config config = (Config) i.next();
    for (Iterator j = active.iterator(); j.hasNext(); ) {
        ConnectionImpl c = checkConnection(j.next());
        if (c.satisfies(config)) {
      if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE, "found an active " +
               "connection for reusing:\n{0}\n{1}",
               new Object[] {c, config});
      }
      if (!checkedResolvePermission) {
          try {
        checkResolvePermission();
          } catch (SecurityException e) {
        if (logger.isLoggable(Levels.FAILED)) {
            LogUtil.logThrow(logger, Levels.FAILED,
          ConnectionEndpointImpl.class, "connect",
          "exception resolving host {0}",
          new Object[] { serverHost }, e);
        }
        throw e;
          }
          checkedResolvePermission = true;
      }
      try {
          c.checkConnectPermission();
          return c;
      } catch (SecurityException e) {
          if (logger.isLoggable(Levels.HANDLED)) {
        LogUtil.logThrow(logger, Levels.HANDLED,
            ConnectionEndpointImpl.class, "connect",
            "access to reuse connection {0} denied",
            new Object[] { c.sock }, e);
          }
      }
        }
    }
      }

      for (Iterator i = configList.iterator(); i.hasNext(); ) {
    Config config = (Config) i.next();
    for (Iterator j = idle.iterator(); j.hasNext(); ) {
        ConnectionImpl c = checkConnection(j.next());
        if (c.switchTo(config)) {
      if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE, "found an idle " +
View Full Code Here

      boolean doable = false;
      ConfigIter citer =
    new ConfigIter(cpCandidates, serverPrincipal, true);
    outer:
      while (citer.hasNext()) {
    Config config = citer.next();
    for (Iterator iter = constraints.requirements().iterator();
         iter.hasNext(); )
    {
        InvocationConstraint c =
      (InvocationConstraint) iter.next();
View Full Code Here

      final Config config;

      InboundRequestHandleImpl(boolean encry) {
    /* doEncryption is switchable, cannot be directly
       extracted from the enclosing connection */
    config = new Config(clientPrincipal, serverPrincipal,
            encry, doDelegation);
      }
View Full Code Here

  // javadoc is inherited from the ConnectionEndpoint interface
  public Connection connect(OutboundRequestHandle handle)
      throws IOException
  {
      RequestHandleImpl rh = checkRequestHandleImpl(handle);
      Config config = null;
      Exception exceptionCaught = null;
      try {
    /* do permission and credential check, pick the config
       to be used */
    List configs = rh.getConfigs();
View Full Code Here

    return null; // the other connect will be called later
      }

      boolean checkedResolvePermission = false;
      for (Iterator i = configList.iterator(); i.hasNext(); ) {
    Config config = (Config) i.next();
    for (Iterator j = active.iterator(); j.hasNext(); ) {
        ConnectionImpl c = checkConnection(j.next());
        if (c.satisfies(config)) {
      if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE, "found an active " +
               "connection for reusing:\n{0}\n{1}",
               new Object[] {c, config});
      }
      if (!checkedResolvePermission) {
          try {
        checkResolvePermission();
          } catch (SecurityException e) {
        if (logger.isLoggable(Levels.FAILED)) {
            LogUtil.logThrow(logger, Levels.FAILED,
          ConnectionEndpointImpl.class, "connect",
          "exception resolving host {0}",
          new Object[] { serverHost }, e);
        }
        throw e;
          }
          checkedResolvePermission = true;
      }
      try {
          c.checkConnectPermission();
          return c;
      } catch (SecurityException e) {
          if (logger.isLoggable(Levels.HANDLED)) {
        LogUtil.logThrow(logger, Levels.HANDLED,
            ConnectionEndpointImpl.class, "connect",
            "access to reuse connection {0} denied",
            new Object[] { c.sock }, e);
          }
      }
        }
    }
      }

      for (Iterator i = configList.iterator(); i.hasNext(); ) {
    Config config = (Config) i.next();
    for (Iterator j = idle.iterator(); j.hasNext(); ) {
        ConnectionImpl c = checkConnection(j.next());
        if (c.switchTo(config)) {
      if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE, "found an idle " +
View Full Code Here

      boolean doable = false;
      ConfigIter citer =
    new ConfigIter(cpCandidates, serverPrincipal, true);
    outer:
      while (citer.hasNext()) {
    Config config = citer.next();
    for (Iterator iter = constraints.requirements().iterator();
         iter.hasNext(); )
    {
        InvocationConstraint c =
      (InvocationConstraint) iter.next();
View Full Code Here

      final Config config;

      InboundRequestHandleImpl(boolean encry) {
    /* doEncryption is switchable, cannot be directly
       extracted from the enclosing connection */
    config = new Config(clientPrincipal, serverPrincipal,
            encry, doDelegation);
      }
View Full Code Here

    outer:
      for (ConfigIter citer = new ConfigIter(
         clientPrincipals, serverPrincipal, canDeleg);
     citer.hasNext(); )
      {
    Config config = citer.next();
    for (Iterator jter = constraints.requirements().iterator();
         jter.hasNext(); )
    {
        InvocationConstraint c =
      (InvocationConstraint) jter.next();
        if (!KerberosUtil.isSatisfiable(config, c))
      continue outer;
    }
    configArr.add(config);
      }

      if (configArr.size() == 0) {
    errorCode = UNSATISFIABLE_CONSTRAINT_REQUIRED;
    detailedExceptionMsg = "Constraints unsatisfiable by this " +
        "endpoint with the current subject have been required: " +
        constraints + ", while the KerberosPrincipal set of " +
        "the subject is: " + subjectClientPrincipals;
    return;
      }

      configs = (Config[]) configArr.toArray(
    new Config[configArr.size()]);

      // reorder configs by the num of preferences a config can satisfy
      for (int i = 0; i < configs.length; i++) {
    for (Iterator iter = constraints.preferences().iterator();
         iter.hasNext(); )
          {
        InvocationConstraint c =
      (InvocationConstraint) iter.next();
        if (KerberosUtil.isSatisfiable(configs[i], c))
      configs[i].prefCount++;
    }
      }
      Arrays.sort(configs, new Comparator() {
        public int compare(Object o1, Object o2) {
      Config config1 = (Config) o1;
      Config config2 = (Config) o2;
      // sort to descending order by prefCount
      return config2.prefCount - config1.prefCount;
        }
    });
View Full Code Here

TOP

Related Classes of net.jini.jeri.kerberos.KerberosUtil.Config

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.