01: // ========================================================================
02: // Copyright 2003-2005 Mort Bay Consulting Pty. Ltd.
03: // ------------------------------------------------------------------------
04: // Licensed under the Apache License, Version 2.0 (the "License");
05: // you may not use this file except in compliance with the License.
06: // You may obtain a copy of the License at
07: // http://www.apache.org/licenses/LICENSE-2.0
08: // Unless required by applicable law or agreed to in writing, software
09: // 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: /** Authenticate.
29: * @param realm an <code>UserRealm</code> value
30: * @param pathInContext a <code>String</code> value
31: * @param request a <code>Request</code> value
32: * @param response a <code>Response</code> value. If non-null response is passed,
33: * then a failed authentication will result in a challenge response being
34: * set in the response.
35: * @return User <code>Principal</code> if authenticated. Null if Authentication
36: * failed. If the SecurityConstraint.__NOBODY instance is returned,
37: * the request is considered as part of the authentication process.
38: * @exception IOException if an error occurs
39: */
40: public Principal authenticate(UserRealm realm,
41: String pathInContext, Request request, Response response)
42: throws IOException;
43:
44: /* ------------------------------------------------------------ */
45: public String getAuthMethod();
46: }
|