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: */
17: package org.apache.jetspeed.security.impl;
18:
19: import org.apache.jetspeed.security.LoginModuleProxy;
20: import org.apache.jetspeed.security.UserManager;
21:
22: /**
23: * @see org.apache.jetspeed.security.LoginModuleProxy
24: * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
25: */
26: public class LoginModuleProxyImpl implements LoginModuleProxy {
27: /** The {@link LoginModuleProxy}instance. */
28: static LoginModuleProxy loginModuleProxy;
29:
30: /** The {@link UserManager}. */
31: private UserManager userMgr;
32:
33: /** The portal user role. */
34: private String portalUserRole;
35:
36: /**
37: * <p>
38: * Constructor providing a bridge between the login module and the user
39: * manager.
40: * </p>
41: *
42: * @param userMgr The user manager.
43: * @param portalUserRole The portal user role shared by all portal users: used
44: * in web.xml authorization to detect authenticated portal
45: * users.
46: *
47: */
48: public LoginModuleProxyImpl(UserManager userMgr,
49: String portalUserRole) {
50: // The user manager.
51: this .userMgr = userMgr;
52:
53: // The portal user role
54: this .portalUserRole = (portalUserRole != null ? portalUserRole
55: : DEFAULT_PORTAL_USER_ROLE_NAME);
56:
57: // Hack providing access to the UserManager in the LoginModule.
58: // TODO Can we fix this?
59: LoginModuleProxyImpl.loginModuleProxy = this ;
60: }
61:
62: public LoginModuleProxyImpl(UserManager userMgr) {
63: this (userMgr, DEFAULT_PORTAL_USER_ROLE_NAME);
64: }
65:
66: /**
67: * @see org.apache.jetspeed.security.LoginModuleProxy#getUserManager()
68: */
69: public UserManager getUserManager() {
70: return this .userMgr;
71: }
72:
73: /**
74: * @see org.apache.jetspeed.security.LoginModuleProxy#getPortalUserRole()
75: */
76: public String getPortalUserRole() {
77: return this.portalUserRole;
78: }
79: }
|