Source Code Cross Referenced for SSOSiteImpl.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » sso » impl » 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 » Portal » jetspeed 2.1.3 » org.apache.jetspeed.sso.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package org.apache.jetspeed.sso.impl;
019:
020:        import java.util.Collection;
021:        import java.util.Iterator;
022:        import java.util.Vector;
023:
024:        import org.apache.jetspeed.sso.SSOException;
025:        import org.apache.jetspeed.sso.SSOSite;
026:        import org.apache.jetspeed.sso.SSOPrincipal;
027:
028:        /**
029:         * SSOSiteImpl
030:         * 	Class holding information about the Site and credentials for Single Sign on SSO.
031:         *	OJB will map the database entries into this class
032:         *
033:         * @author <a href="mailto:rogerrut@apache.org">Roger Ruttimann</a>
034:         * @version $Id: SSOSiteImpl.java 516448 2007-03-09 16:25:47Z ate $
035:         */
036:
037:        public class SSOSiteImpl implements  SSOSite {
038:
039:            // Private member for OJB mapping
040:            private int siteId;
041:            private String name;
042:            private String siteURL;
043:            private boolean isAllowUserSet;
044:            private boolean isCertificateRequired;
045:
046:            private boolean isChallangeResponseAuthentication;
047:
048:            /* Realm used to do ChallengeResponse Authentication */
049:            private String realm;
050:
051:            private boolean isFormAuthentication;
052:
053:            /* Names of fields for User and Password values. The names are up to the
054:             * application developer and therefore it must be configurable for SSO*/
055:            private String formUserField;
056:            private String formPwdField;
057:
058:            private Collection principals = new Vector();
059:            private Collection remotePrincipals = new Vector();
060:
061:            /**
062:             * 
063:             */
064:            public SSOSiteImpl() {
065:                super ();
066:
067:            }
068:
069:            /*
070:             * Setters and getters for member variables
071:             */
072:
073:            /**
074:             * @return Returns the isAllowUserSet.
075:             */
076:            public boolean isAllowUserSet() {
077:                return isAllowUserSet;
078:            }
079:
080:            /**
081:             * @param isAllowUserSet The isAllowUserSet to set.
082:             */
083:            public void setAllowUserSet(boolean isAllowUserSet) {
084:                this .isAllowUserSet = isAllowUserSet;
085:            }
086:
087:            /**
088:             * @return Returns the isCertificateRequired.
089:             */
090:            public boolean isCertificateRequired() {
091:                return isCertificateRequired;
092:            }
093:
094:            /**
095:             * @param isCertificateRequired The isCertificateRequired to set.
096:             */
097:            public void setCertificateRequired(boolean isCertificateRequired) {
098:                this .isCertificateRequired = isCertificateRequired;
099:            }
100:
101:            /**
102:             * @return Returns the name.
103:             */
104:            public String getName() {
105:                return name;
106:            }
107:
108:            /**
109:             * @param name The name to set.
110:             */
111:            public void setName(String name) {
112:                this .name = name;
113:            }
114:
115:            /**
116:             * @return Returns the principals.
117:             */
118:            public Collection getPrincipals() {
119:                return this .principals;
120:            }
121:
122:            /**
123:             * @param principals The principals to set.
124:             */
125:            public void setPrincipals(Collection principals) {
126:                this .principals.addAll(principals);
127:            }
128:
129:            /**
130:             * @return Returns the siteId.
131:             */
132:            public int getSiteId() {
133:                return siteId;
134:            }
135:
136:            /**
137:             * @param siteId The siteId to set.
138:             */
139:            public void setSiteId(int siteId) {
140:                this .siteId = siteId;
141:            }
142:
143:            /**
144:             * @return Returns the siteURL.
145:             */
146:            public String getSiteURL() {
147:                return siteURL;
148:            }
149:
150:            /**
151:             * @param siteURL The siteURL to set.
152:             */
153:            public void setSiteURL(String siteURL) {
154:                this .siteURL = siteURL;
155:            }
156:
157:            /**
158:             * Utility functions
159:             * addCredential()
160:             * Adds the credentail to the credentials collection
161:             *
162:             */
163:
164:            /**
165:             * addPrincipal
166:             * Adds the SSOPrincipal to the principals collection
167:             *
168:             */
169:            public void addPrincipal(SSOPrincipal principal)
170:                    throws SSOException {
171:                boolean bStatus = false;
172:
173:                try {
174:                    bStatus = principals.add(principal);
175:                } catch (Exception e) {
176:                    // Adding credentail to coollection failed -- notify caller with SSOException
177:                    throw new SSOException(
178:                            SSOException.FAILED_ADDING_PRINCIPAL_TO_MAPPING_TABLE_FOR_SITE
179:                                    + e.getMessage());
180:                }
181:
182:                if (bStatus == false)
183:                    throw new SSOException(
184:                            SSOException.FAILED_ADDING_PRINCIPAL_TO_MAPPING_TABLE_FOR_SITE);
185:            }
186:
187:            /**
188:             * removePrincipal()
189:             * removes a principal from the principals collection
190:             *
191:             */
192:            public void removePrincipal(long principalId) throws SSOException {
193:                boolean bStatus = false;
194:                SSOPrincipal principalObj = null;
195:                Iterator itSitePrincipals = principals.iterator();
196:
197:                while (itSitePrincipals.hasNext()) {
198:                    principalObj = (SSOPrincipal) itSitePrincipals.next();
199:                    if (principalObj.getPrincipalId() == principalId) {
200:
201:                        try {
202:                            bStatus = principals.remove(principalObj);
203:                        } catch (Exception e) {
204:                            // Adding credentail to coollection failed -- notify caller with SSOException
205:                            throw new SSOException(
206:                                    SSOException.FAILED_REMOVING_PRINCIPAL_FROM_MAPPING_TABLE_FOR_SITE
207:                                            + e.getMessage());
208:                        }
209:
210:                        if (bStatus == false)
211:                            throw new SSOException(
212:                                    SSOException.FAILED_REMOVING_PRINCIPAL_FROM_MAPPING_TABLE_FOR_SITE);
213:                    }
214:
215:                }
216:            }
217:
218:            /**
219:             * @return Returns the remotePrincipals.
220:             */
221:            public Collection getRemotePrincipals() {
222:                return remotePrincipals;
223:            }
224:
225:            /**
226:             * @param remotePrincipals The remotePrincipals to set.
227:             */
228:            public void setRemotePrincipals(Collection remotePrincipals) {
229:                this .remotePrincipals = remotePrincipals;
230:            }
231:
232:            /**
233:             * Define the Authentication methods. 
234:             * Supported are: Challenge Response and From based
235:             */
236:            /**
237:             * Form authentication requires two fields that hold the credential 
238:             * information for the request.
239:             */
240:            public void setFormAuthentication(String formUserField,
241:                    String formPwdField) {
242:                // Set the fields for Form Authentication and clear other authentication methods
243:
244:            }
245:
246:            /*
247:             * Uses Challenge Response mechanism for authentication
248:             */
249:            public void setChallengeResponseAuthentication() {
250:                // Set the fields for ChallengeResponse and clear other authentication methods
251:
252:            }
253:
254:            /* Setters/Getters for Authentication settings */
255:            public String getFormPwdField() {
256:                return formPwdField;
257:            }
258:
259:            public void setFormPwdField(String formPwdField) {
260:                this .formPwdField = formPwdField;
261:            }
262:
263:            public String getFormUserField() {
264:                return formUserField;
265:            }
266:
267:            public void setFormUserField(String formUserField) {
268:                this .formUserField = formUserField;
269:            }
270:
271:            public boolean isChallangeResponseAuthentication() {
272:                return isChallangeResponseAuthentication;
273:            }
274:
275:            public void setChallengeResponseAuthentication(
276:                    boolean isChallangeResponseAuthentication) {
277:                this .isChallangeResponseAuthentication = isChallangeResponseAuthentication;
278:            }
279:
280:            public boolean isFormAuthentication() {
281:                return isFormAuthentication;
282:            }
283:
284:            public void setFormAuthentication(boolean isFormAuthentication) {
285:                this .isFormAuthentication = isFormAuthentication;
286:            }
287:
288:            public void configFormAuthentication(String formUserField,
289:                    String formPwdField) {
290:                this .isFormAuthentication = true;
291:                this .setChallengeResponseAuthentication(false);
292:
293:                this .formPwdField = formPwdField;
294:                this .formUserField = formUserField;
295:            }
296:
297:            /*
298:             *  (non-Javadoc)
299:             * @see org.apache.jetspeed.sso.SSOSite#setRealm(java.lang.String)
300:             */
301:            public void setRealm(String realm) {
302:                this .realm = realm;
303:            }
304:
305:            /*
306:             *  (non-Javadoc)
307:             * @see org.apache.jetspeed.sso.SSOSite#getRealm()
308:             */
309:            public String getRealm() {
310:                return this.realm;
311:            }
312:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.