1 /**
2 *
3 * Copyright 2004 The Apache Software Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.geronimo.jetty;
18
19 import java.security.Principal;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.mortbay.http.HttpRequest;
24 import org.mortbay.http.UserRealm;
25
26
27 /**
28 * @version $Rev: 397916 $ $Date: 2006-04-28 08:12:20 -0700 (Fri, 28 Apr 2006) $
29 */
30 public class JAASJettyRealm implements UserRealm {
31 private static Log log = LogFactory.getLog(JAASJettyRealm.class);
32
33 private final String webRealmName;
34 private final InternalJAASJettyRealm internalJAASJettyRealm;
35
36 public JAASJettyRealm(String realmName, InternalJAASJettyRealm internalJAASJettyRealm) {
37 this.webRealmName = realmName;
38 this.internalJAASJettyRealm = internalJAASJettyRealm;
39 }
40
41 public String getName() {
42 return webRealmName;
43 }
44
45 public Principal getPrincipal(String username) {
46 return internalJAASJettyRealm.getPrincipal(username);
47 }
48
49 public Principal authenticate(String username, Object credentials, HttpRequest request) {
50 return internalJAASJettyRealm.authenticate(username, credentials, request);
51 }
52
53 public boolean reauthenticate(Principal user) {
54 return internalJAASJettyRealm.reauthenticate(user);
55 }
56
57 public boolean isUserInRole(Principal user, String role) {
58 return internalJAASJettyRealm.isUserInRole(user, role);
59 }
60
61 public void disassociate(Principal user) {
62 internalJAASJettyRealm.disassociate(user);
63 }
64
65 public Principal pushRole(Principal user, String role) {
66 return internalJAASJettyRealm.pushRole(user, role);
67 }
68
69 public Principal popRole(Principal user) {
70 return internalJAASJettyRealm.popRole(user);
71 }
72
73 public void logout(Principal user) {
74 internalJAASJettyRealm.logout(user);
75 }
76
77 public String getSecurityRealmName() {
78 return internalJAASJettyRealm.getSecurityRealmName();
79 }
80
81 }