01: // ========================================================================
02: // Copyright 2000-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.security.Principal;
18:
19: import org.mortbay.jetty.Request;
20: import org.mortbay.jetty.Response;
21:
22: /* ------------------------------------------------------------ */
23: /** Single Sign On Realm.
24: * This interface is a mix-in interface for the UserRealm interface. If an
25: * implementation of UserRealm also implements SSORealm, then single signon
26: * is supported for that realm.
27:
28: * @see UserRealm
29: * @author Greg Wilkins (gregw)
30: */
31:
32: public interface SSORealm {
33: /** Get SSO credentials.
34: * This call is used by an authenticator to check if a SSO exists for a request.
35: * If SSO authentiation is successful, the requests UserPrincipal and
36: * AuthUser fields are set. If available, the credential used to
37: * authenticate the user is returned. If recoverable credentials are not required then
38: * null may be return.
39: * @param request The request to SSO.
40: * @param response The response to SSO.
41: * @return A credential if available for SSO authenticated requests.
42: */
43: public Credential getSingleSignOn(Request request, Response response);
44:
45: /** Set SSO principal and credential.
46: * This call is used by an authenticator to inform the SSO mechanism that
47: * a user has signed on. The SSO mechanism should record the principal
48: * and credential and update the response with any cookies etc. required.
49: * @param request The authenticated request.
50: * @param response The authenticated response/
51: * @param principal The principal that has been authenticated.
52: * @param credential The credentials used to authenticate.
53: */
54:
55: public void setSingleSignOn(Request request, Response response,
56: Principal principal, Credential credential);
57:
58: /** Clear SSO for user.
59: * @param username The user to clear.
60: */
61: public void clearSingleSignOn(String username);
62: }
|