Source Code Cross Referenced for LdapRealmForm.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » security » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.webapp.jonasadmin.security 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library 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 library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: LdapRealmForm.java 6599 2005-04-21 08:59:54Z kemlerp $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.webapp.jonasadmin.security;
027:
028:        import java.util.List;
029:
030:        import javax.servlet.http.HttpServletRequest;
031:
032:        import org.apache.struts.action.ActionMessage;
033:        import org.apache.struts.action.ActionErrors;
034:        import org.apache.struts.action.ActionMapping;
035:        import org.objectweb.jonas.webapp.jonasadmin.Jlists;
036:
037:        /**
038:         * @author Michel-Ange ANTON
039:         */
040:        public class LdapRealmForm extends FactoryRealmForm {
041:
042:            // --------------------------------------------------------- Constants
043:
044:            // --------------------------------------------------------- Properties variables
045:
046:            private String authenticationMode = null;
047:            private String baseDn = null;
048:            private String initialContextFactory = null;
049:            private String language = null;
050:            private String providerUrl = null;
051:            private String referral = null;
052:            private String roleDn = null;
053:            private String roleNameAttribute = null;
054:            private String roleSearchFilter = null;
055:            private String securityAuthentication = null;
056:            private String securityCredentials = null;
057:            private String securityPrincipal = null;
058:            private String securityProtocol = null;
059:            private String stateFactories = null;
060:            private String userDn = null;
061:            private String userPasswordAttribute = null;
062:            private String userRolesAttribute = null;
063:            private String userSearchFilter = null;
064:            private String algorithm = null;
065:
066:            private List securityAuthenticationLdapValues = Jlists
067:                    .getSecurityAuthenticationLdapValues();
068:            private List authenticationModeLdapValues = Jlists
069:                    .getAuthenticationModeLdapValues();
070:            private List securityAlgorithms = Jlists.getSecurityAlgorithms();
071:
072:            // --------------------------------------------------------- Public Methods
073:
074:            /**
075:             * Reset all properties to their default values.
076:             *
077:             * @param mapping The mapping used to select this instance
078:             * @param request The servlet request we are processing
079:             */
080:
081:            public void reset(ActionMapping mapping, HttpServletRequest request) {
082:                super .reset(mapping, request);
083:
084:                authenticationMode = "bind";
085:                baseDn = null;
086:                initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory";
087:                language = null;
088:                providerUrl = "ldap://localhost:389";
089:                referral = null;
090:                roleDn = null;
091:                roleNameAttribute = "cn";
092:                roleSearchFilter = "uniqueMember={0}";
093:                securityAuthentication = "simple";
094:                securityCredentials = null;
095:                securityPrincipal = null;
096:                securityProtocol = null;
097:                stateFactories = null;
098:                userDn = null;
099:                userPasswordAttribute = "userPassword";
100:                userRolesAttribute = "memberOf";
101:                userSearchFilter = "uid={0}";
102:            }
103:
104:            /**
105:             * Validate the properties that have been set from this HTTP request,
106:             * and return an <code>ActionErrors</code> object that encapsulates any
107:             * validation errors that have been found.  If no errors are found, return
108:             * <code>null</code> or an <code>ActionErrors</code> object with no
109:             * recorded error messages.
110:             *
111:             * @param mapping The mapping used to select this instance
112:             * @param request The servlet request we are processing
113:             * @return List of errors
114:             */
115:            public ActionErrors validate(ActionMapping mapping,
116:                    HttpServletRequest request) {
117:                ActionErrors oErrors = new ActionErrors();
118:                if ((getName() == null) || (getName().length() == 0)) {
119:                    oErrors.add("name", new ActionMessage(
120:                            "error.security.factory.ldap.realm.name.required"));
121:                }
122:                if ((baseDn == null) || (baseDn.length() == 0)) {
123:                    oErrors
124:                            .add(
125:                                    "baseDn",
126:                                    new ActionMessage(
127:                                            "error.security.factory.ldap.realm.baseDn.required"));
128:                }
129:                if ((initialContextFactory == null)
130:                        || (initialContextFactory.length() == 0)) {
131:                    oErrors
132:                            .add(
133:                                    "initialContextFactory",
134:                                    new ActionMessage(
135:                                            "error.security.factory.ldap.realm.initialContextFactory.required"));
136:                    initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory";
137:                }
138:                if ((providerUrl == null) || (providerUrl.length() == 0)) {
139:                    oErrors
140:                            .add(
141:                                    "providerUrl",
142:                                    new ActionMessage(
143:                                            "error.security.factory.ldap.realm.providerUrl.required"));
144:                    providerUrl = "ldap://localhost:389";
145:                }
146:                if ((roleNameAttribute == null)
147:                        || (roleNameAttribute.length() == 0)) {
148:                    oErrors
149:                            .add(
150:                                    "roleNameAttribute",
151:                                    new ActionMessage(
152:                                            "error.security.factory.ldap.realm.roleNameAttribute.required"));
153:                    roleNameAttribute = "cn";
154:                }
155:                if ((roleSearchFilter == null)
156:                        || (roleSearchFilter.length() == 0)) {
157:                    oErrors
158:                            .add(
159:                                    "roleSearchFilter",
160:                                    new ActionMessage(
161:                                            "error.security.factory.ldap.realm.roleSearchFilter.required"));
162:                    roleSearchFilter = "uniqueMember={0}";
163:                }
164:                if ((userPasswordAttribute == null)
165:                        || (userPasswordAttribute.length() == 0)) {
166:                    oErrors
167:                            .add(
168:                                    "userPasswordAttribute",
169:                                    new ActionMessage(
170:                                            "error.security.factory.ldap.realm.userPasswordAttribute.required"));
171:                    userPasswordAttribute = "userPassword";
172:                }
173:                if ((userRolesAttribute == null)
174:                        || (userRolesAttribute.length() == 0)) {
175:                    oErrors
176:                            .add(
177:                                    "userRolesAttribute",
178:                                    new ActionMessage(
179:                                            "error.security.factory.ldap.realm.userRolesAttribute.required"));
180:                    userRolesAttribute = "memberOf";
181:                }
182:                if ((userSearchFilter == null)
183:                        || (userSearchFilter.length() == 0)) {
184:                    oErrors
185:                            .add(
186:                                    "userSearchFilter",
187:                                    new ActionMessage(
188:                                            "error.security.factory.ldap.realm.userSearchFilter.required"));
189:                    userSearchFilter = "uid={0}";
190:                }
191:                return oErrors;
192:            }
193:
194:            // --------------------------------------------------------- Properties Methods
195:
196:            public String getAuthenticationMode() {
197:                return authenticationMode;
198:            }
199:
200:            public void setAuthenticationMode(String authenticationMode) {
201:                this .authenticationMode = authenticationMode;
202:            }
203:
204:            public String getBaseDn() {
205:                return baseDn;
206:            }
207:
208:            public void setBaseDn(String baseDn) {
209:                this .baseDn = baseDn;
210:            }
211:
212:            public String getInitialContextFactory() {
213:                return initialContextFactory;
214:            }
215:
216:            public void setInitialContextFactory(String initialContextFactory) {
217:                this .initialContextFactory = initialContextFactory;
218:            }
219:
220:            public String getLanguage() {
221:                return language;
222:            }
223:
224:            public void setLanguage(String language) {
225:                this .language = language;
226:            }
227:
228:            public String getProviderUrl() {
229:                return providerUrl;
230:            }
231:
232:            public void setProviderUrl(String providerUrl) {
233:                this .providerUrl = providerUrl;
234:            }
235:
236:            public String getReferral() {
237:                return referral;
238:            }
239:
240:            public void setReferral(String referral) {
241:                this .referral = referral;
242:            }
243:
244:            public String getRoleDn() {
245:                return roleDn;
246:            }
247:
248:            public void setRoleDn(String roleDn) {
249:                this .roleDn = roleDn;
250:            }
251:
252:            public String getRoleNameAttribute() {
253:                return roleNameAttribute;
254:            }
255:
256:            public void setRoleNameAttribute(String roleNameAttribute) {
257:                this .roleNameAttribute = roleNameAttribute;
258:            }
259:
260:            public String getRoleSearchFilter() {
261:                return roleSearchFilter;
262:            }
263:
264:            public void setRoleSearchFilter(String roleSearchFilter) {
265:                this .roleSearchFilter = roleSearchFilter;
266:            }
267:
268:            public String getSecurityAuthentication() {
269:                return securityAuthentication;
270:            }
271:
272:            public void setSecurityAuthentication(String securityAuthentication) {
273:                this .securityAuthentication = securityAuthentication;
274:            }
275:
276:            public String getSecurityCredentials() {
277:                return securityCredentials;
278:            }
279:
280:            public void setSecurityCredentials(String securityCredentials) {
281:                this .securityCredentials = securityCredentials;
282:            }
283:
284:            public String getSecurityPrincipal() {
285:                return securityPrincipal;
286:            }
287:
288:            public void setSecurityPrincipal(String securityPrincipal) {
289:                this .securityPrincipal = securityPrincipal;
290:            }
291:
292:            public String getSecurityProtocol() {
293:                return securityProtocol;
294:            }
295:
296:            public void setSecurityProtocol(String securityProtocol) {
297:                this .securityProtocol = securityProtocol;
298:            }
299:
300:            public String getStateFactories() {
301:                return stateFactories;
302:            }
303:
304:            public void setStateFactories(String stateFactories) {
305:                this .stateFactories = stateFactories;
306:            }
307:
308:            public String getUserDn() {
309:                return userDn;
310:            }
311:
312:            public void setUserDn(String userDn) {
313:                this .userDn = userDn;
314:            }
315:
316:            public String getUserPasswordAttribute() {
317:                return userPasswordAttribute;
318:            }
319:
320:            public void setUserPasswordAttribute(String userPasswordAttribute) {
321:                this .userPasswordAttribute = userPasswordAttribute;
322:            }
323:
324:            public String getUserRolesAttribute() {
325:                return userRolesAttribute;
326:            }
327:
328:            public void setUserRolesAttribute(String userRolesAttribute) {
329:                this .userRolesAttribute = userRolesAttribute;
330:            }
331:
332:            public String getUserSearchFilter() {
333:                return userSearchFilter;
334:            }
335:
336:            public void setUserSearchFilter(String userSearchFilter) {
337:                this .userSearchFilter = userSearchFilter;
338:            }
339:
340:            public List getSecurityAuthenticationLdapValues() {
341:                return securityAuthenticationLdapValues;
342:            }
343:
344:            public List getAuthenticationModeLdapValues() {
345:                return authenticationModeLdapValues;
346:            }
347:
348:            public String getAlgorithm() {
349:                return algorithm;
350:            }
351:
352:            public void setAlgorithm(String algorithm) {
353:                this .algorithm = algorithm;
354:            }
355:
356:            public List getSecurityAlgorithms() {
357:                return securityAlgorithms;
358:            }
359:
360:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.