01: /*
02: * JOSSO: Java Open Single Sign-On
03: *
04: * Copyright 2004-2008, Atricore, Inc.
05: *
06: * This is free software; you can redistribute it and/or modify it
07: * under the terms of the GNU Lesser General Public License as
08: * published by the Free Software Foundation; either version 2.1 of
09: * the License, or (at your option) any later version.
10: *
11: * This software is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this software; if not, write to the Free
18: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20: */
21:
22: package org.josso.wls92.agent.jaas;
23:
24: import org.josso.gateway.SSONameValuePair;
25: import org.josso.gateway.identity.SSOUser;
26: import org.josso.gateway.identity.service.BaseUser;
27: import weblogic.security.principal.WLSAbstractPrincipal;
28:
29: /**
30: * This principal extends Weblogic abstract principal, implementing also SSOUser interface.
31: * WebLogic exptects principals to implement WLUser and WLRole interfaces.
32: *
33: * Date: Nov 26, 2007
34: * Time: 7:24:03 PM
35: *
36: * @author <a href="mailto:sgonzalez@josso.org">Sebastian Gonzalez Oyuela</a>
37: */
38: public class WLSJOSSOUser extends WLSAbstractPrincipal implements
39: SSOUser {
40:
41: private SSOUser ssoUser;
42:
43: public WLSJOSSOUser(SSOUser ssoUser) {
44: super ();
45: if (ssoUser == null)
46: throw new NullPointerException("ssoUser cannot be null");
47: this .ssoUser = ssoUser;
48: super .setName(ssoUser.getName());
49: }
50:
51: /**
52: * @deprecated alwasy returns null
53: */
54: public String getSessionId() {
55: return null;
56: }
57:
58: public String getName() {
59: return ssoUser.getName();
60: }
61:
62: protected void setName(String newName) {
63:
64: // Keep name in sync
65: if (ssoUser instanceof BaseUser)
66: ((BaseUser) ssoUser).setName(newName);
67:
68: super .setName(newName);
69: }
70:
71: public SSONameValuePair[] getProperties() {
72: return this.ssoUser.getProperties();
73: }
74:
75: }
|