Examples of Type1Message


Examples of com.knowgate.jcifs.ntlmssp.Type1Message

        connection.connect();
        int response = parseResponseCode();
        if (response != HTTP_UNAUTHORIZED && response != HTTP_PROXY_AUTH) {
            return;
        }
        Type1Message type1 = (Type1Message) attemptNegotiation(response);
        if (type1 == null) return; // no NTLM
        int attempt = 0;
        while (attempt < MAX_REDIRECTS) {
            connection.setRequestProperty(authProperty, method + ' ' + Base64Encoder.encode(type1.toByteArray()));
            connection.connect(); // send type 1
            response = parseResponseCode();
            if (response != HTTP_UNAUTHORIZED && response != HTTP_PROXY_AUTH) {
                return;
            }
View Full Code Here

Examples of com.knowgate.jcifs.ntlmssp.Type1Message

        if (method == null) return null;
        NtlmMessage message = (authorization != null) ?
                new Type2Message(Base64Decoder.decodeToBytes(authorization)) : null;
        reconnect();
        if (message == null) {
            message = new Type1Message();
            if (LM_COMPATIBILITY > 2) {
                message.setFlag(NtlmFlags.NTLMSSP_REQUEST_TARGET, true);
            }
        } else {
            String domain = DEFAULT_DOMAIN;
View Full Code Here

Examples of com.knowgate.jcifs.ntlmssp.Type1Message

                    throws IOException, ServletException {
        String msg = req.getHeader("Authorization");
        if (msg != null && msg.startsWith("NTLM ")) {
            byte[] src = Base64Decoder.decodeToBytes(msg.substring(5));
            if (src[8] == 1) {
                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);
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

                    throws IOException, ServletException {
        String msg = req.getHeader("Authorization");
        if (msg != null && msg.startsWith("NTLM ")) {
            byte[] src = Base64.decode(msg.substring(5));
            if (src[8] == 1) {
                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);
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

        try {
            int response = parseResponseCode();
            if (response != HTTP_UNAUTHORIZED && response != HTTP_PROXY_AUTH) {
                return;
            }
            Type1Message type1 = (Type1Message) attemptNegotiation(response);
            if (type1 == null) return; // no NTLM
            int attempt = 0;
            while (attempt < MAX_REDIRECTS) {
                connection.setRequestProperty(authProperty, authMethod + ' ' +
                        Base64.encode(type1.toByteArray()));
                connection.connect(); // send type 1
                response = parseResponseCode();
                if (response != HTTP_UNAUTHORIZED &&
                        response != HTTP_PROXY_AUTH) {
                    return;
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

        if (authMethod == null) return null;
        NtlmMessage message = (authorization != null) ?
                new Type2Message(Base64.decode(authorization)) : null;
        reconnect();
        if (message == null) {
            message = new Type1Message();
            if (LM_COMPATIBILITY > 2) {
                message.setFlag(NtlmFlags.NTLMSSP_REQUEST_TARGET, true);
            }
        } else {
            String domain = DEFAULT_DOMAIN;
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

     * @param domain the client domain
     * @return a {@link Type1Message} to initiate the authentication process.
     */
    public Type1Message createType1Message(String host, String domain)
    {
        Type1Message message = new Type1Message(DEFAULT_TYPE_1_MESSAGE_FLAGS, domain, host);

        // Type1Message constructor sets a default workstation name when host == null, so it
        // requires an override of that value in order to make it work
        if (host == null)
        {
            message.setSuppliedWorkstation(null);
        }

        return message;
    }
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

            final byte[] challenge = SmbSession.getChallenge(dc);

            switch (src[8]) {
                case 1:
                    log.debug("Type 1 received");
                    final Type1Message type1 = new Type1Message(src);
                    final Type2Message type2 = new Type2Message(type1,
                        challenge, null);
                    log.debug("Type 2 returned. Setting next token.");
                    ntlmCredentials.setNextToken(type2.toByteArray());
                    return false;
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

            }
        }
        // reconnect();
        int flags = NtlmFlags.NTLMSSP_NEGOTIATE_NTLM2 | NtlmFlags.NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NtlmFlags.NTLMSSP_NEGOTIATE_NTLM | NtlmFlags.NTLMSSP_REQUEST_TARGET | NtlmFlags.NTLMSSP_NEGOTIATE_OEM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE;
        if (message == null) {
            message = new Type1Message(flags, null, null);
        } else {
            credentials = credentials.substring(authMethod.length()+1); // strip off the "NTLM " or "Negotiate "
            credentials = new String(Base64.decode(credentials)); // decode the base64
            String domain = credentials.substring(0, credentials.indexOf("\\"));
            String user = credentials.substring(domain.length()+1, credentials.indexOf(":"));
View Full Code Here

Examples of jcifs.ntlmssp.Type1Message

     * @param domain the client domain
     * @return a {@link Type1Message} to initiate the authentication process.
     */
    public Type1Message createType1Message(String host, String domain)
    {
        Type1Message message = new Type1Message(DEFAULT_TYPE_1_MESSAGE_FLAGS, domain, host);

        // Type1Message constructor sets a default workstation name when host == null, so it
        // requires an override of that value in order to make it work
        if (host == null)
        {
            message.setSuppliedWorkstation(null);
        }

        return message;
    }
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.