--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.authentication.UserAuthenticator\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.authentication;\r
+\r
+import java.util.Properties;\r
+import java.sql.SQLException;\r
+\r
+/**\r
+ * The UserAuthenticator interface provides operations to authenticate\r
+ * a user's credentials in order to successfully connect to a database.\r
+ * \r
+ * Any user authentication schemes could be implemented using this interface\r
+ * and registered at start-up time.\r
+ * <p>\r
+ * If an application requires its own authentication scheme, then it can\r
+ * implement this interface and register as the authentication scheme\r
+ * that Derby should call upon connection requests to the system.\r
+ See the dcoumentation for the property <I>derby.authentication.provider</I>\r
+ * <p>\r
+ * A typical example would be to implement user authentication using\r
+ * LDAP, Sun NIS+, or even Windows User Domain, using this interface.\r
+ * <p>\r
+ * <i>Note</i>: Additional connection attributes can be specified on the \r
+ * database connection URL and/or Properties object on jdbc connection. Values\r
+ * for these attributes can be retrieved at runtime by the (specialized)\r
+ * authentication scheme to further help user authentication, if one needs\r
+ * additional info other than user, password, and database name.\r
+ *\r
+ *\r
+ */\r
+\r
+public interface UserAuthenticator\r
+{\r
+ \r
+ /**\r
+ * Authenticate a user's credentials.\r
+ * <BR>\r
+ * E.g. if connection url is \r
+ * <code>jdbc:derby:testdb;user=Fred;password=ScT7dmM2</code>\r
+ * then the userName will be Fred and within the Derby user authorization \r
+ * system, Fred becomes a case-insensitive authorization identifier and \r
+ * is known as FRED\r
+ *<BR>\r
+ * if connection url is \r
+ * <code>jdbc:derby:testdb;user="Fred";password=ScT7dmM2</code>\r
+ * then the userName will be "Fred" and within the Derby user authorization\r
+ * system, Fred becomes a case-sensitive authorization identifier and is\r
+ * known as Fred\r
+ * <BR>\r
+ *\r
+ * @param userName The user's name for the connection request. May be \r
+ * null. The user name is passed in as is from the \r
+ * connection request.\r
+ * Derby will pass in the user name that is set on\r
+ * connection request as is, without changing the \r
+ * casing and without removing the delimiter quotes \r
+ * if any.\r
+ *\r
+ * @param userPassword The user's password for the connection request. \r
+ * May be null.\r
+ *\r
+ * @param databaseName The database that the user wants to connect to.\r
+ * Will be null if this is system level authentication.\r
+ *\r
+ * @param info A Properties object that contains additional \r
+ * connection information, that can help to \r
+ * authenticate the user. It has properties of the \r
+ * 'info' object passed as part of \r
+ * DriverManager.getConnection() call and any \r
+ * attributes set on the JDBC URL.\r
+ *\r
+ * @return false if the connection request should be denied, true if the \r
+ * connection request should proceed. If false is returned the \r
+ * connection attempt will receive a SQLException with SQL State \r
+ * 08004.\r
+ *\r
+ * @exception java.sql.SQLException An exception processing the request, \r
+ * connection request will be denied. The SQL exception will \r
+ * be returned to the connection attempt.\r
+ */\r
+ public boolean authenticateUser(String userName,\r
+ String userPassword,\r
+ String databaseName,\r
+ Properties info\r
+ )\r
+ throws SQLException;\r
+}\r