001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020package org.apache.directory.server.ldap.handlers.sasl.ntlm;
021
022
023import org.apache.mina.core.session.IoSession;
024
025
026/**
027 * An NTLM authentication service provider.  Multiple providers may be
028 * utilized to conduct the NTLM negotiation over various protocols or by
029 * calling native SSPI interfaces.
030 *
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public interface NtlmProvider
034{
035    /**
036     * Handles a Type 1 NTLM response from the client to generate an NTLM
037     * Type 2 challenge message.
038     *
039     * @param session the MINA IoSession to store any state to be thread safe
040     * @param type1reponse the Type 1 NTLM response from client
041     * @return the NTLM Type 2 message with the challenge
042     * @throws Exception If the challenge cannot be generated
043     */
044    byte[] generateChallenge( IoSession session, byte[] type1reponse ) throws Exception;
045
046
047    /**
048     * Handles a Type 3 NTLM response from the client.
049     *
050     * @param session the MINA IoSession to store any state to be thread safe
051     * @param type3response the Type 3 NTLM response from the client
052     * @return the result of the authentication from the server
053     * @throws Exception If the authentication failed
054     */
055    boolean authenticate( IoSession session, byte[] type3response ) throws Exception;
056}