001: /*
002: * JOSSO: Java Open Single Sign-On
003: *
004: * Copyright 2004-2008, Atricore, Inc.
005: *
006: * This is free software; you can redistribute it and/or modify it
007: * under the terms of the GNU Lesser General Public License as
008: * published by the Free Software Foundation; either version 2.1 of
009: * the License, or (at your option) any later version.
010: *
011: * This software is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this software; if not, write to the Free
018: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
020: */
021:
022: /**
023: * SSOIdentityManagerSoapBindingImpl.java
024: *
025: * This file was auto-generated from WSDL
026: * by the Apache Axis 1.2alpha ago 27, 2004 (08:42:06 GMT-03:00) WSDL2Java emitter.
027: */package org.josso.gateway.identity.service.ws.impl;
028:
029: import org.josso.Lookup;
030: import org.josso.SecurityDomain;
031: import org.josso.gateway.identity.exceptions.SSOIdentityException;
032:
033: import java.rmi.RemoteException;
034: import java.util.ArrayList;
035: import java.util.List;
036:
037: public class SSOIdentityManagerSoapBindingImpl implements
038: org.josso.gateway.identity.service.ws.impl.SSOIdentityManager {
039:
040: public void setIdentityStoreKeyAdapter(Object in0)
041: throws RemoteException {
042:
043: }
044:
045: public void initialize() throws RemoteException {
046:
047: }
048:
049: public org.josso.gateway.identity.service.ws.impl.SSOUser findUser(
050: java.lang.String in0)
051: throws java.rmi.RemoteException,
052: org.josso.gateway.identity.service.ws.impl.SSOIdentityException,
053: org.josso.gateway.identity.service.ws.impl.NoSuchUserException {
054:
055: try {
056: SecurityDomain domain = Lookup.getInstance()
057: .lookupSecurityDomain();
058:
059: org.josso.gateway.identity.SSOUser ssoUser;
060: ssoUser = domain.getIdentityManager().findUser(in0);
061: return adaptSSOUser(ssoUser);
062: } catch (NoSuchUserException e) {
063: throw new org.josso.gateway.identity.service.ws.impl.NoSuchUserException();
064: } catch (SSOIdentityException e) {
065: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
066: } catch (Exception e) {
067: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
068: }
069:
070: }
071:
072: public org.josso.gateway.identity.service.ws.impl.SSOUser findUserInSession(
073: java.lang.String in0)
074: throws java.rmi.RemoteException,
075: org.josso.gateway.identity.service.ws.impl.SSOIdentityException,
076: org.josso.gateway.identity.service.ws.impl.NoSuchUserException {
077:
078: try {
079: SecurityDomain domain = Lookup.getInstance()
080: .lookupSecurityDomain();
081: org.josso.gateway.identity.SSOUser ssoUser;
082: ssoUser = domain.getIdentityManager()
083: .findUserInSession(in0);
084: return adaptSSOUser(ssoUser);
085: } catch (NoSuchUserException e) {
086: throw new org.josso.gateway.identity.service.ws.impl.NoSuchUserException();
087: } catch (SSOIdentityException e) {
088: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
089: } catch (Exception e) {
090: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
091: }
092: }
093:
094: public SSORole[] findRolesByUsername(String in0)
095: throws RemoteException,
096: org.josso.gateway.identity.service.ws.impl.SSOIdentityException {
097:
098: try {
099: SecurityDomain domain = Lookup.getInstance()
100: .lookupSecurityDomain();
101: org.josso.gateway.identity.SSORole[] ssoUserRoles;
102: ssoUserRoles = domain.getIdentityManager()
103: .findRolesByUsername(in0);
104: return adaptSSORoles(ssoUserRoles);
105: } catch (SSOIdentityException e) {
106: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
107: } catch (Exception e) {
108: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
109: }
110:
111: }
112:
113: public void userExists(String in0)
114: throws RemoteException,
115: org.josso.gateway.identity.service.ws.impl.SSOIdentityException,
116: NoSuchUserException {
117: try {
118: SecurityDomain domain = Lookup.getInstance()
119: .lookupSecurityDomain();
120: domain.getIdentityManager().userExists(in0);
121: } catch (NoSuchUserException e) {
122: throw new org.josso.gateway.identity.service.ws.impl.NoSuchUserException();
123: } catch (SSOIdentityException e) {
124: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
125: } catch (Exception e) {
126: throw new org.josso.gateway.identity.service.ws.impl.SSOIdentityException();
127: }
128: }
129:
130: protected org.josso.gateway.identity.service.ws.impl.SSOUser adaptSSOUser(
131: org.josso.gateway.identity.SSOUser srcSSOUser) {
132: org.josso.gateway.identity.service.ws.impl.SSOUser targetSSOUser = new org.josso.gateway.identity.service.ws.impl.SSOUser();
133:
134: targetSSOUser.setName(srcSSOUser.getName());
135: targetSSOUser.setSessionId(srcSSOUser.getSessionId());
136:
137: //org.josso.gateway.identity.service.ws.impl.SSONameValuePair targetSSONameValuePair[];
138:
139: List targetSSONameValuePair = new ArrayList();
140: org.josso.gateway.SSONameValuePair[] srcSSONameValuePair = srcSSOUser
141: .getProperties();
142:
143: for (int i = 0; i < srcSSONameValuePair.length; i++) {
144: targetSSONameValuePair
145: .add(adaptSSONameValuePair(srcSSONameValuePair[i]));
146: }
147:
148: targetSSOUser
149: .setProperties((org.josso.gateway.identity.service.ws.impl.SSONameValuePair[]) targetSSONameValuePair
150: .toArray(new org.josso.gateway.identity.service.ws.impl.SSONameValuePair[srcSSONameValuePair.length]));
151:
152: return targetSSOUser;
153: }
154:
155: protected org.josso.gateway.identity.service.ws.impl.SSONameValuePair adaptSSONameValuePair(
156: org.josso.gateway.SSONameValuePair srcSSONameValuePair) {
157: org.josso.gateway.identity.service.ws.impl.SSONameValuePair targetSSONameValuePair = new org.josso.gateway.identity.service.ws.impl.SSONameValuePair();
158:
159: targetSSONameValuePair.setName(srcSSONameValuePair.getName());
160: targetSSONameValuePair.setValue(srcSSONameValuePair.getValue());
161:
162: return targetSSONameValuePair;
163: }
164:
165: protected org.josso.gateway.identity.service.ws.impl.SSORole adaptSSORole(
166: org.josso.gateway.identity.SSORole srcSSORole) {
167: org.josso.gateway.identity.service.ws.impl.SSORole targetSSORole = new org.josso.gateway.identity.service.ws.impl.SSORole();
168:
169: targetSSORole.setName(srcSSORole.getName());
170: return targetSSORole;
171:
172: }
173:
174: protected org.josso.gateway.identity.service.ws.impl.SSORole[] adaptSSORoles(
175: org.josso.gateway.identity.SSORole[] srcSSORoles) {
176:
177: ArrayList targetRoles = new ArrayList();
178: for (int i = 0; i < srcSSORoles.length; i++) {
179: targetRoles.add(adaptSSORole(srcSSORoles[i]));
180: }
181:
182: return (org.josso.gateway.identity.service.ws.impl.SSORole[]) targetRoles
183: .toArray(new SSORole[targetRoles.size()]);
184: }
185:
186: }
|