Source Code Cross Referenced for WebserviceSSOIdentityManager.java in  » Authentication-Authorization » josso-1.7 » org » josso » gateway » identity » service » ws » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Authentication Authorization » josso 1.7 » org.josso.gateway.identity.service.ws 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        package org.josso.gateway.identity.service.ws;
022:
023:        import org.apache.commons.logging.Log;
024:        import org.apache.commons.logging.LogFactory;
025:        import org.josso.gateway.identity.SSORole;
026:        import org.josso.gateway.identity.SSOUser;
027:        import org.josso.gateway.identity.exceptions.NoSuchUserException;
028:        import org.josso.gateway.identity.exceptions.SSOIdentityException;
029:        import org.josso.gateway.identity.service.BaseRoleImpl;
030:        import org.josso.gateway.identity.service.BaseUserImpl;
031:        import org.josso.gateway.identity.service.SSOIdentityManager;
032:        import org.josso.gateway.identity.service.store.IdentityStore;
033:        import org.josso.gateway.identity.service.store.IdentityStoreKeyAdapter;
034:
035:        import java.util.ArrayList;
036:        import java.util.List;
037:
038:        /**
039:         * Webservice client implementation for the SSO Identity Manager based on
040:         * the Axis-generated Stub & Skeleton.
041:         *
042:         * @author <a href="mailto:gbrigand@josso.org">Gianluca Brigandi</a>
043:         * @version CVS $Id: WebserviceSSOIdentityManager.java 508 2008-02-18 13:32:29Z sgonzalez $
044:         */
045:
046:        public class WebserviceSSOIdentityManager implements 
047:                org.josso.gateway.identity.service.SSOIdentityManager {
048:            private static final Log logger = LogFactory
049:                    .getLog(SSOIdentityManager.class);
050:
051:            private org.josso.gateway.identity.service.ws.impl.SSOIdentityManager _wsSSOIdentityManager;
052:
053:            private int _errorCount;
054:
055:            private int _processedCount;
056:
057:            /**
058:             * Build a Webservice SSO Identity Manager.
059:             *
060:             * @param wsSSOIdentityManager the SOAP stub to be invoked.
061:             */
062:            public WebserviceSSOIdentityManager(
063:                    org.josso.gateway.identity.service.ws.impl.SSOIdentityManager wsSSOIdentityManager) {
064:                _wsSSOIdentityManager = wsSSOIdentityManager;
065:            }
066:
067:            /**
068:             * Initializes this manager instance.
069:             */
070:            public void initialize() {
071:
072:            }
073:
074:            /**
075:             * Finds a user based on its name.  The name is a unique identifier of the user, probably the user login.
076:             *
077:             * @param name
078:             *
079:             * @throws org.josso.gateway.identity.exceptions.NoSuchUserException
080:             *          if the user does not exist.
081:             */
082:            public SSOUser findUser(String name) throws NoSuchUserException,
083:                    SSOIdentityException {
084:
085:                try {
086:                    if (logger.isDebugEnabled())
087:                        logger.debug("[findUser()] : " + name);
088:                    return adaptSSOUser(_wsSSOIdentityManager.findUser(name));
089:                } catch (org.josso.gateway.identity.service.ws.impl.NoSuchUserException e) {
090:                    throw new NoSuchUserException(e.getMessage());
091:
092:                } catch (java.rmi.RemoteException e) {
093:                    _errorCount++;
094:                    throw new SSOIdentityException(e.getMessage(), e);
095:                } finally {
096:                    _processedCount++;
097:                }
098:            }
099:
100:            /**
101:             * Finds the user associated to a sso session
102:             *
103:             * @param sessionId the sso session identifier
104:             *
105:             * @throws org.josso.gateway.identity.exceptions.NoSuchUserException
106:             *          if no user is associated to this session id.
107:             */
108:            public SSOUser findUserInSession(String sessionId)
109:                    throws NoSuchUserException, SSOIdentityException {
110:
111:                try {
112:                    if (logger.isDebugEnabled())
113:                        logger.debug("[findUserInSession()] : " + sessionId);
114:                    return adaptSSOUser(_wsSSOIdentityManager
115:                            .findUserInSession(sessionId));
116:
117:                } catch (org.josso.gateway.identity.service.ws.impl.SSOIdentityException e) {
118:                    throw new SSOIdentityException(e.getMessage(), e);
119:
120:                } catch (java.rmi.RemoteException e) {
121:                    _errorCount++;
122:                    throw new SSOIdentityException(e.getMessage(), e);
123:                } finally {
124:                    _processedCount++;
125:                }
126:            }
127:
128:            /**
129:             * Finds a collection of user's roles.
130:             * Elements in the collection are SSORole instances.
131:             *
132:             * @param username
133:             *
134:             * @throws org.josso.gateway.identity.exceptions.SSOIdentityException
135:             *
136:             */
137:            public SSORole[] findRolesByUsername(String username)
138:                    throws SSOIdentityException {
139:                try {
140:                    if (logger.isDebugEnabled())
141:                        logger.debug("[findRolesByUsername()] : " + username);
142:                    return adaptSSORoles(_wsSSOIdentityManager
143:                            .findRolesByUsername(username));
144:                } catch (java.rmi.RemoteException e) {
145:                    _errorCount++;
146:                    throw new SSOIdentityException(e.getMessage(), e);
147:                } finally {
148:                    _processedCount++;
149:                }
150:            }
151:
152:            public void userExists(String username) throws NoSuchUserException,
153:                    SSOIdentityException {
154:                try {
155:                    if (logger.isDebugEnabled())
156:                        logger.debug("[userExists()] : " + username);
157:                    _wsSSOIdentityManager.userExists(username);
158:                } catch (java.rmi.RemoteException e) {
159:                    _errorCount++;
160:                    throw new SSOIdentityException(e.getMessage(), e);
161:                } finally {
162:                    _processedCount++;
163:                }
164:            }
165:
166:            /**
167:             * Maps a SOAP SSOUser type instance to a JOSSO SSOUser type instance.
168:             *
169:             * @param srcSSOUser the SOAP type instance to be mapped.
170:             * @return the mapped user
171:             */
172:            protected org.josso.gateway.identity.SSOUser adaptSSOUser(
173:                    org.josso.gateway.identity.service.ws.impl.SSOUser srcSSOUser) {
174:
175:                BaseUserImpl targetSSOUser = new BaseUserImpl();
176:
177:                targetSSOUser.setName(srcSSOUser.getName());
178:
179:                // map Properties
180:                org.josso.gateway.identity.service.ws.impl.SSONameValuePair[] properties = srcSSOUser
181:                        .getProperties();
182:
183:                List nvList = new ArrayList();
184:                for (int i = 0; i < properties.length; i++) {
185:                    nvList.add(adaptSSOValuePair(properties[i]));
186:                }
187:
188:                targetSSOUser
189:                        .setProperties((org.josso.gateway.SSONameValuePair[]) nvList
190:                                .toArray(new org.josso.gateway.SSONameValuePair[nvList
191:                                        .size()]));
192:
193:                return targetSSOUser;
194:            }
195:
196:            /**
197:             * Maps a SOAP SSOValuePair type instance to a JOSSO SSOValuePair type instance.
198:             *
199:             * @param srcSSONameValuePair the SOAP type instance to be mapped.
200:             * @return the mapped value pair
201:             */
202:            protected org.josso.gateway.SSONameValuePair adaptSSOValuePair(
203:                    org.josso.gateway.identity.service.ws.impl.SSONameValuePair srcSSONameValuePair) {
204:
205:                BaseUserImpl targetSSOUser = new BaseUserImpl();
206:                org.josso.gateway.SSONameValuePair targetSSONameValuePair = new org.josso.gateway.SSONameValuePair(
207:                        srcSSONameValuePair.getName(), srcSSONameValuePair
208:                                .getValue());
209:
210:                return targetSSONameValuePair;
211:            }
212:
213:            /**
214:             * Maps a SOAP SSORole type instance to a JOSSO SSORole type instance.
215:             *
216:             * @param srcSSORole the SOAP type instance to be mapped.
217:             * @return the mapped role
218:             */
219:            protected org.josso.gateway.identity.SSORole adaptSSORole(
220:                    org.josso.gateway.identity.service.ws.impl.SSORole srcSSORole) {
221:
222:                BaseRoleImpl targetSSORole = new BaseRoleImpl();
223:
224:                targetSSORole.setName(srcSSORole.getName());
225:                return targetSSORole;
226:            }
227:
228:            /**
229:             * Maps one or more SOAP SSORole type instancess to one or more JOSSO SSORole type instances.
230:             *
231:             * @param srcSSORoles the SOAP type instances to be mapped.
232:             * @return the mapped roles
233:             */
234:            protected org.josso.gateway.identity.SSORole[] adaptSSORoles(
235:                    org.josso.gateway.identity.service.ws.impl.SSORole[] srcSSORoles) {
236:
237:                ArrayList targetSSORoles = new ArrayList();
238:                for (int i = 0; i < srcSSORoles.length; i++) {
239:                    targetSSORoles.add(adaptSSORole(srcSSORoles[i]));
240:                }
241:
242:                return (SSORole[]) targetSSORoles
243:                        .toArray(new BaseRoleImpl[targetSSORoles.size()]);
244:            }
245:
246:            /**
247:             * Provided for compatibility only ...
248:             */
249:            public void setIdentityStoreKeyAdapter(IdentityStoreKeyAdapter a) {
250:                throw new UnsupportedOperationException(
251:                        "Not supported by this type of manager");
252:            }
253:
254:            /**
255:             * Provided for compatibility only ...
256:             */
257:            public void setIdentityStore(IdentityStore is) {
258:                throw new UnsupportedOperationException(
259:                        "Not supported by this type of manager");
260:            }
261:
262:            public int getErrorCount() {
263:                return _errorCount;
264:            }
265:
266:            public int getProcessedCount() {
267:                return _processedCount;
268:            }
269:
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.