Source Code Cross Referenced for SpecificAuthenticationServiceImpl.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » jdbc » authentication » 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 » Database DBMS » db derby 10.2 » org.apache.derby.impl.jdbc.authentication 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.jdbc.authentication.SpecificAuthenticationServiceImpl
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           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, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.jdbc.authentication;
023:
024:        import org.apache.derby.iapi.reference.SQLState;
025:        import org.apache.derby.iapi.reference.ClassName;
026:
027:        import org.apache.derby.iapi.error.StandardException;
028:        import org.apache.derby.iapi.jdbc.AuthenticationService;
029:        import org.apache.derby.iapi.util.StringUtil;
030:        import org.apache.derby.authentication.UserAuthenticator;
031:
032:        import org.apache.derby.iapi.services.property.PropertyUtil;
033:
034:        import java.util.Properties;
035:
036:        /**
037:         * This authentication service is a specific/user defined User authentication
038:         * level support.
039:         * <p>
040:         * It calls the specific User authentication scheme defined by the user/
041:         * administrator.
042:         *
043:         * @author Francois
044:         */
045:        public class SpecificAuthenticationServiceImpl extends
046:                AuthenticationServiceBase {
047:
048:            private String specificAuthenticationScheme;
049:
050:            //
051:            // ModuleControl implementation (overriden)
052:            //
053:
054:            /**
055:             *  Check if we should activate this authentication service.
056:             */
057:            public boolean canSupport(Properties properties) {
058:
059:                //
060:                // we check 2 things:
061:                // - if derby.connection.requireAuthentication system
062:                //   property is set to true.
063:                // - if derby.authentication.provider is set and is not equal
064:                //	 to LDAP or BUILTIN.
065:                //
066:                // and in that case we are the authentication service that should
067:                // be run.
068:                //
069:                if (!requireAuthentication(properties))
070:                    return false;
071:
072:                specificAuthenticationScheme = PropertyUtil
073:                        .getPropertyFromSet(
074:                                properties,
075:                                org.apache.derby.iapi.reference.Property.AUTHENTICATION_PROVIDER_PARAMETER);
076:                if (((specificAuthenticationScheme != null)
077:                        && (specificAuthenticationScheme.length() != 0) &&
078:
079:                (!((StringUtil
080:                        .SQLEqualsIgnoreCase(
081:                                specificAuthenticationScheme,
082:                                org.apache.derby.iapi.reference.Property.AUTHENTICATION_PROVIDER_BUILTIN)) || (specificAuthenticationScheme
083:                        .equalsIgnoreCase(org.apache.derby.iapi.reference.Property.AUTHENTICATION_PROVIDER_LDAP))))))
084:                    return true;
085:                else
086:                    return false;
087:            }
088:
089:            /**
090:             * @see org.apache.derby.iapi.services.monitor.ModuleControl#boot
091:             * @exception StandardException upon failure to load/boot the expected
092:             * authentication service.
093:             */
094:            public void boot(boolean create, Properties properties)
095:                    throws StandardException {
096:
097:                // We need authentication
098:                // setAuthentication(true);
099:
100:                // we call the super in case there is anything to get initialized.
101:                super .boot(create, properties);
102:
103:                // We must retrieve and load the authentication scheme that we were
104:                // told to. The class loader will report an exception if it could not
105:                // find the class in the classpath.
106:                //
107:                // We must then make sure that the ImplementationScheme loaded,
108:                // implements the published UserAuthenticator interface we
109:                // provide.
110:                //
111:
112:                Throwable t;
113:                try {
114:
115:                    Class sasClass = Class
116:                            .forName(specificAuthenticationScheme);
117:                    if (!UserAuthenticator.class.isAssignableFrom(sasClass)) {
118:                        throw StandardException
119:                                .newException(
120:                                        SQLState.AUTHENTICATION_NOT_IMPLEMENTED,
121:                                        specificAuthenticationScheme,
122:                                        "org.apache.derby.authentication.UserAuthenticator");
123:                    }
124:
125:                    UserAuthenticator aScheme = (UserAuthenticator) sasClass
126:                            .newInstance();
127:
128:                    // Set ourselves as being ready and loading the proper
129:                    // authentication scheme for this service
130:                    //
131:                    this .setAuthenticationService(aScheme);
132:
133:                    return;
134:
135:                } catch (ClassNotFoundException cnfe) {
136:                    t = cnfe;
137:                } catch (InstantiationException ie) {
138:                    t = ie;
139:                } catch (IllegalAccessException iae) {
140:                    t = iae;
141:                }
142:                throw StandardException.newException(
143:                        SQLState.AUTHENTICATION_SCHEME_ERROR, t,
144:                        specificAuthenticationScheme);
145:            }
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.