コード例 #1
0
 /**
  * Creates a Type-2 message in response to the given Type-1 message.
  *
  * @param type1 The Type-1 message which this represents a response to.
  * @param challenge The challenge from the domain controller/server.
  * @param target The authentication target.
  */
 public Type2Message(Type1Message type1, byte[] challenge, String target) {
   this(
       getDefaultFlags(type1),
       challenge,
       (type1 != null && target == null && type1.getFlag(NTLMSSP_REQUEST_TARGET))
           ? getDefaultDomain()
           : target);
 }
コード例 #2
0
 /**
  * Returns the default flags for a Type-2 message created in response to the given Type-1 message
  * in the current environment.
  *
  * @return An <code>int</code> containing the default flags.
  */
 public static int getDefaultFlags(Type1Message type1) {
   if (type1 == null) return DEFAULT_FLAGS;
   int flags = NTLMSSP_NEGOTIATE_NTLM;
   int type1Flags = type1.getFlags();
   flags |=
       ((type1Flags & NTLMSSP_NEGOTIATE_UNICODE) != 0)
           ? NTLMSSP_NEGOTIATE_UNICODE
           : NTLMSSP_NEGOTIATE_OEM;
   if ((type1Flags & NTLMSSP_REQUEST_TARGET) != 0) {
     String domain = getDefaultDomain();
     if (domain != null) {
       flags |= NTLMSSP_REQUEST_TARGET | NTLMSSP_TARGET_TYPE_DOMAIN;
     }
   }
   return flags;
 }