src/share/classes/com/sun/jndi/ldap/DigestClientId.java

Print this page




  48         "javax.security.sasl.qop",
  49         "javax.security.sasl.strength",
  50         "javax.security.sasl.reuse",
  51         "javax.security.sasl.server.authentication",
  52         "javax.security.sasl.maxbuffer",
  53         "javax.security.sasl.policy.noplaintext",
  54         "javax.security.sasl.policy.noactive",
  55         "javax.security.sasl.policy.nodictionary",
  56         "javax.security.sasl.policy.noanonymous",
  57         "javax.security.sasl.policy.forward",
  58         "javax.security.sasl.policy.credentials",
  59     };
  60 
  61     final private String[] propvals;
  62     final private int myHash;
  63     private int pHash = 0;
  64 
  65     DigestClientId(int version, String hostname, int port,
  66         String protocol, Control[] bindCtls, OutputStream trace,
  67         String socketFactory, String username,
  68         Object passwd, Hashtable env) {
  69 
  70         super(version, hostname, port, protocol, bindCtls, trace,
  71             socketFactory, username, passwd);
  72 
  73         if (env == null) {
  74             propvals = null;
  75         } else {
  76             // Could be smarter and apply default values for props
  77             // but for now, we just record and check exact matches
  78             propvals = new String[SASL_PROPS.length];
  79             for (int i = 0; i < SASL_PROPS.length; i++) {
  80                 propvals[i] = (String) env.get(SASL_PROPS[i]);
  81                 if (propvals[i] != null) {
  82                     pHash = pHash * 31 + propvals[i].hashCode();
  83                 }
  84             }
  85         }
  86         myHash = super.hashCode() + pHash;
  87     }
  88 




  48         "javax.security.sasl.qop",
  49         "javax.security.sasl.strength",
  50         "javax.security.sasl.reuse",
  51         "javax.security.sasl.server.authentication",
  52         "javax.security.sasl.maxbuffer",
  53         "javax.security.sasl.policy.noplaintext",
  54         "javax.security.sasl.policy.noactive",
  55         "javax.security.sasl.policy.nodictionary",
  56         "javax.security.sasl.policy.noanonymous",
  57         "javax.security.sasl.policy.forward",
  58         "javax.security.sasl.policy.credentials",
  59     };
  60 
  61     final private String[] propvals;
  62     final private int myHash;
  63     private int pHash = 0;
  64 
  65     DigestClientId(int version, String hostname, int port,
  66         String protocol, Control[] bindCtls, OutputStream trace,
  67         String socketFactory, String username,
  68         Object passwd, Hashtable<?,?> env) {
  69 
  70         super(version, hostname, port, protocol, bindCtls, trace,
  71             socketFactory, username, passwd);
  72 
  73         if (env == null) {
  74             propvals = null;
  75         } else {
  76             // Could be smarter and apply default values for props
  77             // but for now, we just record and check exact matches
  78             propvals = new String[SASL_PROPS.length];
  79             for (int i = 0; i < SASL_PROPS.length; i++) {
  80                 propvals[i] = (String) env.get(SASL_PROPS[i]);
  81                 if (propvals[i] != null) {
  82                     pHash = pHash * 31 + propvals[i].hashCode();
  83                 }
  84             }
  85         }
  86         myHash = super.hashCode() + pHash;
  87     }
  88