1 // ======================================================================== 2 // Copyright 2003-2005 Mort Bay Consulting Pty. Ltd. 3 // ------------------------------------------------------------------------ 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 // ======================================================================== 14 15 package org.mortbay.jetty.security; 16 17 import java.io.IOException; 18 import java.io.Serializable; 19 import java.security.Principal; 20 21 import org.mortbay.jetty.Request; 22 import org.mortbay.jetty.Response; 23 24 /** Authenticator Interface. 25 * This is the interface that must be implemented to provide authentication implementations to the HttpContext. 26 */ 27 public interface Authenticator extends Serializable 28 { 29 /** Authenticate. 30 * @param realm an <code>UserRealm</code> value 31 * @param pathInContext a <code>String</code> value 32 * @param request a <code>Request</code> value 33 * @param response a <code>Response</code> value. If non-null response is passed, 34 * then a failed authentication will result in a challenge response being 35 * set in the response. 36 * @return User <code>Principal</code> if authenticated. Null if Authentication 37 * failed. If the SecurityConstraint.__NOBODY instance is returned, 38 * the request is considered as part of the authentication process. 39 * @exception IOException if an error occurs 40 */ 41 public Principal authenticate( 42 UserRealm realm, 43 String pathInContext, 44 Request request, 45 Response response) 46 throws IOException; 47 48 /* ------------------------------------------------------------ */ 49 public String getAuthMethod(); 50 }