Examples of Type3Message


Examples of com.knowgate.jcifs.ntlmssp.Type3Message

            connection.connect(); // send type 1
            response = parseResponseCode();
            if (response != HTTP_UNAUTHORIZED && response != HTTP_PROXY_AUTH) {
                return;
            }
            Type3Message type3 = (Type3Message) attemptNegotiation(response);
            if (type3 == null) return;
            connection.setRequestProperty(authProperty, method + ' ' + Base64Encoder.encode(type3.toByteArray()));
            connection.connect(); // send type 3
            response = parseResponseCode();
            if (response != HTTP_UNAUTHORIZED && response != HTTP_PROXY_AUTH) {
                return;
            }
View Full Code Here

Examples of com.knowgate.jcifs.ntlmssp.Type3Message

                        password = new String(auth.getPassword());
                    }
                } catch (Exception ex) { }
            }
            Type2Message type2 = (Type2Message) message;
            message = new Type3Message(type2, password, domain, user,
                    Type3Message.getDefaultWorkstation());
        }
        return message;
    }
View Full Code Here

Examples of com.knowgate.jcifs.ntlmssp.Type3Message

                Type1Message type1 = new Type1Message(src);
                Type2Message type2 = new Type2Message(type1, challenge, null);
                msg = Base64Encoder.encode(type2.toByteArray());
                resp.setHeader( "WWW-Authenticate", "NTLM " + msg );
            } else if (src[8] == 3) {
                Type3Message type3 = new Type3Message(src);
                byte[] lmResponse = type3.getLMResponse();
                if (lmResponse == null) lmResponse = new byte[0];
                byte[] ntResponse = type3.getNTResponse();
                if (ntResponse == null) ntResponse = new byte[0];
                return new NtlmPasswordAuthentication(type3.getDomain(),
                        type3.getUser(), challenge, lmResponse, ntResponse);
            }
        } else {
            resp.setHeader("WWW-Authenticate", "NTLM");
            resp.setHeader("Connection", "close");
        }
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

                Type1Message type1 = new Type1Message(src);
                Type2Message type2 = new Type2Message(type1, challenge, null);
                msg = Base64.encode(type2.toByteArray());
                resp.setHeader( "WWW-Authenticate", "NTLM " + msg );
            } else if (src[8] == 3) {
                Type3Message type3 = new Type3Message(src);
                byte[] lmResponse = type3.getLMResponse();
                if (lmResponse == null) lmResponse = new byte[0];
                byte[] ntResponse = type3.getNTResponse();
                if (ntResponse == null) ntResponse = new byte[0];
                return new NtlmPasswordAuthentication(type3.getDomain(),
                        type3.getUser(), challenge, lmResponse, ntResponse);
            }
        } else {
            resp.setHeader("WWW-Authenticate", "NTLM");
        }
        resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

                response = parseResponseCode();
                if (response != HTTP_UNAUTHORIZED &&
                        response != HTTP_PROXY_AUTH) {
                    return;
                }
                Type3Message type3 = (Type3Message)
                        attemptNegotiation(response);
                if (type3 == null) return;
                connection.setRequestProperty(authProperty, authMethod + ' ' +
                        Base64.encode(type3.toByteArray()));
                connection.connect(); // send type 3
                if (cachedOutput != null && doOutput) {
                    OutputStream output = connection.getOutputStream();
                    cachedOutput.writeTo(output);
                    output.flush();
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

                    user = auth.getUserName();
                    password = new String(auth.getPassword());
                } catch (Exception ex) { }
            }
            Type2Message type2 = (Type2Message) message;
            message = new Type3Message(type2, password, domain, user,
                    Type3Message.getDefaultWorkstation(), 0);
        }
        return message;
    }
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

     *        in response to a {@link Type1Message} message previously sent.
     * @return a {@link Type3Message} to continue the authentication process.
     */
    public Type3Message createType3Message(NTCredentials ntCredentials, Type2Message type2Message)
    {
        return new Type3Message(type2Message, ntCredentials.getPassword(), type2Message.getTarget(),
                                ntCredentials.getUserName(), ntCredentials.getHost(), DEFAULT_TYPE_3_MESSAGE_FLAGS);
    }
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

                    log.debug("Type 2 returned. Setting next token.");
                    ntlmCredentials.setNextToken(type2.toByteArray());
                    return false;
                case 3:
                    log.debug("Type 3 received");
                    final Type3Message type3 = new Type3Message(src);
                    final byte[] lmResponse = type3.getLMResponse() == null
                        ? new byte[0] : type3.getLMResponse();
                    byte[] ntResponse = type3.getNTResponse() == null
                        ? new byte[0] : type3.getNTResponse();
                    final NtlmPasswordAuthentication ntlm = new NtlmPasswordAuthentication(
                        type3.getDomain(), type3.getUser(), challenge,
                        lmResponse, ntResponse);
                    log.debug("Trying to authenticate " + type3.getUser()
                        + " with domain controller");
                    try {
                        SmbSession.logon(dc, ntlm);
                        ntlmCredentials.setPrincipal(new SimplePrincipal(type3
                            .getUser()));
                        return true;
                    } catch (final SmbAuthException sae) {
                        log.debug("Authentication failed", sae);
                        return false;
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

            String domain = credentials.substring(0, credentials.indexOf("\\"));
            String user = credentials.substring(domain.length()+1, credentials.indexOf(":"));
            String password = credentials.substring(domain.length()+user.length()+2);
            Type2Message type2 = (Type2Message) message;
            flags ^= NtlmFlags.NTLMSSP_NEGOTIATE_OEM;
            message = new Type3Message(type2, password, domain, user, null, flags);
        }
        return authMethod + " " + Base64.encode(message.toByteArray());
    }
View Full Code Here

Examples of jcifs.ntlmssp.Type3Message

     *        in response to a {@link Type1Message} message previously sent.
     * @return a {@link Type3Message} to continue the authentication process.
     */
    public Type3Message createType3Message(NTCredentials ntCredentials, Type2Message type2Message)
    {
        return new Type3Message(type2Message, ntCredentials.getPassword(), type2Message.getTarget(),
                                ntCredentials.getUserName(), ntCredentials.getHost(), DEFAULT_TYPE_3_MESSAGE_FLAGS);
    }
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.