Source Code Cross Referenced for LDAPSecurityConstants.java in  » Web-Framework » TURBINE » org » apache » turbine » services » security » ldap » 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 » Web Framework » TURBINE » org.apache.turbine.services.security.ldap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.services.security.ldap;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import java.util.Properties;
023:
024:        import org.apache.turbine.services.security.TurbineSecurity;
025:
026:        /**
027:         * <p>This is a static class for defining the default ldap confiquration
028:         * keys used by core Turbine components.</p>
029:         *
030:         * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
031:         * @author <a href="mailto:hhernandez@itweb.com.mx">Humberto Hernandez</a>
032:         * @version $Id: LDAPSecurityConstants.java 534527 2007-05-02 16:10:59Z tv $
033:         */
034:        public class LDAPSecurityConstants {
035:            /** Property key */
036:            public static final String LDAP_ADMIN_USERNAME_KEY = "ldap.admin.username";
037:
038:            /** Property key */
039:            public static final String LDAP_ADMIN_PASSWORD_KEY = "ldap.admin.password";
040:
041:            /** Property key */
042:            public static final String LDAP_HOST_KEY = "ldap.host";
043:
044:            /** Property default value */
045:            public static final String LDAP_HOST_DEFAULT = "localhost";
046:
047:            /** Property key */
048:            public static final String LDAP_PORT_KEY = "ldap.port";
049:
050:            /** Property default value */
051:            public static final String LDAP_PORT_DEFAULT = "389";
052:
053:            /** Property key */
054:            public static final String LDAP_PROVIDER_KEY = "ldap.provider";
055:
056:            /** Property default value */
057:            public static final String LDAP_PROVIDER_DEFAULT = "com.sun.jndi.ldap.LdapCtxFactory";
058:
059:            /** Property key */
060:            public static final String LDAP_BASE_SEARCH_KEY = "ldap.basesearch";
061:
062:            /** Property key */
063:            public static final String LDAP_AUTH_KEY = "ldap.security.authentication";
064:
065:            /** Property default value */
066:            public static final String LDAP_AUTH_DEFAULT = "simple";
067:
068:            /** Property key */
069:            public static final String LDAP_USER_USERID_KEY = "ldap.user.userid";
070:
071:            /** Property default value */
072:            public static final String LDAP_USER_USERID_DEFAULT = "uid";
073:
074:            /** Property key */
075:            public static final String LDAP_USER_USERNAME_KEY = "ldap.user.username";
076:
077:            /** Property default value */
078:            public static final String LDAP_USER_USERNAME_DEFAULT = "turbineUserUniqueId";
079:
080:            /** Property key */
081:            public static final String LDAP_USER_FIRSTNAME_KEY = "ldap.user.firstname";
082:
083:            /** Property default value */
084:            public static final String LDAP_USER_FIRSTNAME_DEFAULT = "turbineUserFirstName";
085:
086:            /** Property key */
087:            public static final String LDAP_USER_LASTNAME_KEY = "ldap.user.lastname";
088:
089:            /** Property default value */
090:            public static final String LDAP_USER_LASTNAME_DEFAULT = "turbineUserLastName";
091:
092:            /** Property key */
093:            public static final String LDAP_USER_EMAIL_KEY = "ldap.user.email";
094:
095:            /** Property default value */
096:            public static final String LDAP_USER_EMAIL_DEFAULT = "turbineUserMailAddress";
097:
098:            /** Property key */
099:            public static final String LDAP_USER_PASSWORD_KEY = "ldap.user.password";
100:
101:            /** Property default value */
102:            public static final String LDAP_USER_PASSWORD_DEFAULT = "userPassword";
103:
104:            /**
105:             * Get all the properties for the security service.
106:             * @return all the properties of the security service.
107:             */
108:            public static Properties getProperties() {
109:                return TurbineSecurity.getService().getProperties();
110:            }
111:
112:            /**
113:             * Get a property from the LDAP security service.
114:             * @param key The key to access the value of the property.
115:             * @return The value of the property.
116:             */
117:            public static String getProperty(String key) {
118:                return getProperties().getProperty(key);
119:            }
120:
121:            /**
122:             * Get a property from the LDAP security service.
123:             * @param key The key to access the value of the property.
124:             * @param defaultValue The value that the property takes
125:             *        when it doesn't exist.
126:             * @return The value of the property.
127:             */
128:            public static String getProperty(String key, String defaultValue) {
129:                return getProperties().getProperty(key, defaultValue);
130:            }
131:
132:            /**
133:             * Get the value of the property for the administration username.
134:             * @return the value of the property.
135:             */
136:            public static String getAdminUsername() {
137:                String str = getProperty(LDAP_ADMIN_USERNAME_KEY);
138:
139:                /*
140:                 * The adminUsername string contains some
141:                 * characters that need to be transformed.
142:                 */
143:                str = str.replace('/', '=');
144:                str = str.replace('%', ',');
145:                return str;
146:            }
147:
148:            /**
149:             * Get the value of the property for the administration password.
150:             * @return the value of the property.
151:             */
152:            public static String getAdminPassword() {
153:                return getProperty(LDAP_ADMIN_PASSWORD_KEY);
154:            }
155:
156:            /**
157:             * Get the value of the property for the LDAP Host.
158:             * @return the value of the property.
159:             */
160:            public static String getLDAPHost() {
161:                return getProperty(LDAP_HOST_KEY, LDAP_HOST_DEFAULT);
162:            }
163:
164:            /**
165:             * Get the value of the property for the LDAP Port.
166:             * @return the value of the property.
167:             */
168:            public static String getLDAPPort() {
169:                return getProperty(LDAP_PORT_KEY, LDAP_PORT_DEFAULT);
170:            }
171:
172:            /**
173:             * Get the value of the property for the  LDAP Provider.
174:             * @return the value of the property.
175:             */
176:            public static String getLDAPProvider() {
177:                return getProperty(LDAP_PROVIDER_KEY, LDAP_PROVIDER_DEFAULT);
178:            }
179:
180:            /**
181:             * Get value of the property for the Base Search.
182:             * @return the value of the property.
183:             */
184:            public static String getBaseSearch() {
185:                String str = getProperty(LDAP_BASE_SEARCH_KEY);
186:
187:                /*
188:                 * The userBaseSearch string contains some
189:                 * characters that need to be transformed.
190:                 */
191:                str = str.replace('/', '=');
192:                str = str.replace('%', ',');
193:                return str;
194:            }
195:
196:            /**
197:             * Get the value of the property for the Authentication
198:             * mechanism. Valid values are: none, simple,
199:             * @return the value of the property.
200:             */
201:            public static String getLDAPAuthentication() {
202:                return getProperty(LDAP_AUTH_KEY, LDAP_AUTH_DEFAULT);
203:            }
204:
205:            /**
206:             * Get the value of the User id Attribute.
207:             * @return the value of the property.
208:             */
209:            public static String getUserIdAttribute() {
210:                return getProperty(LDAP_USER_USERID_KEY,
211:                        LDAP_USER_USERID_DEFAULT);
212:            }
213:
214:            /**
215:             * Get the value of the Username Attribute.
216:             * @return the value of the property.
217:             */
218:            public static String getNameAttribute() {
219:                return getProperty(LDAP_USER_USERNAME_KEY,
220:                        LDAP_USER_USERNAME_DEFAULT);
221:            }
222:
223:            /**
224:             * Get the value of the Username Attribute.
225:             * @return the value of the property.
226:             * @deprecated Use getNameAttribute()
227:             */
228:            public static String getUserNameAttribute() {
229:                return getNameAttribute();
230:            }
231:
232:            /**
233:             * Get the value of the Firstname Attribute.
234:             * @return the value of the property.
235:             */
236:            public static String getFirstNameAttribute() {
237:                return getProperty(LDAP_USER_FIRSTNAME_KEY,
238:                        LDAP_USER_FIRSTNAME_DEFAULT);
239:            }
240:
241:            /**
242:             * Get the value of the Lastname Attribute.
243:             * @return the value of the property.
244:             */
245:            public static String getLastNameAttribute() {
246:                return getProperty(LDAP_USER_LASTNAME_KEY,
247:                        LDAP_USER_LASTNAME_DEFAULT);
248:            }
249:
250:            /**
251:             * Get the value of the Password Attribute.
252:             * @return the value of the property.
253:             */
254:            public static String getPasswordAttribute() {
255:                return getProperty(LDAP_USER_PASSWORD_KEY,
256:                        LDAP_USER_PASSWORD_DEFAULT);
257:            }
258:
259:            /**
260:             * Get the value of the E-Mail Attribute.
261:             * @return the value of the property.
262:             */
263:            public static String getEmailAttribute() {
264:                return getProperty(LDAP_USER_EMAIL_KEY, LDAP_USER_EMAIL_DEFAULT);
265:            }
266:
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.