01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: */package org.apache.geronimo.jetty6;
17:
18: import java.security.Principal;
19:
20: import org.mortbay.jetty.Request;
21: import org.mortbay.jetty.security.UserRealm;
22:
23: /**
24: * @version $Rev: 482336 $ $Date: 2006-12-04 12:12:19 -0800 (Mon, 04 Dec 2006) $
25: */
26: public class JAASJettyRealm implements UserRealm {
27:
28: private final String webRealmName;
29: private final InternalJAASJettyRealm internalJAASJettyRealm;
30:
31: public JAASJettyRealm(String realmName,
32: InternalJAASJettyRealm internalJAASJettyRealm) {
33: this .webRealmName = realmName;
34: this .internalJAASJettyRealm = internalJAASJettyRealm;
35: }
36:
37: public String getName() {
38: return webRealmName;
39: }
40:
41: public Principal getPrincipal(String username) {
42: return internalJAASJettyRealm.getPrincipal(username);
43: }
44:
45: public Principal authenticate(String username, Object credentials,
46: Request request) {
47: return internalJAASJettyRealm.authenticate(username,
48: credentials, request);
49: }
50:
51: public boolean reauthenticate(Principal user) {
52: return internalJAASJettyRealm.reauthenticate(user);
53: }
54:
55: public boolean isUserInRole(Principal user, String role) {
56: return internalJAASJettyRealm.isUserInRole(user, role);
57: }
58:
59: public void disassociate(Principal user) {
60: internalJAASJettyRealm.disassociate(user);
61: }
62:
63: public Principal pushRole(Principal user, String role) {
64: return internalJAASJettyRealm.pushRole(user, role);
65: }
66:
67: public Principal popRole(Principal user) {
68: return internalJAASJettyRealm.popRole(user);
69: }
70:
71: public void logout(Principal user) {
72: internalJAASJettyRealm.logout(user);
73: }
74:
75: public String getSecurityRealmName() {
76: return internalJAASJettyRealm.getSecurityRealmName();
77: }
78:
79: }
|