[lib-update][cleanup] Move LAM Authentication Manager out of core
authorStefan Hühner <stefan.huehner@openbravo.com>
Wed, 20 Apr 2011 11:19:04 +0200
changeset 11875 0eab00bbe341
parent 11874 dbb679f7b710
child 11876 1fc4dc82c09f
[lib-update][cleanup] Move LAM Authentication Manager out of core
- Move this optional part out of the core module as not used/needed by most users.
Will be provided by a new module 'LAM Authentication Manager' with package:
'org.openbravo.authentication.lam'
- Adjust comments in Openbravo.properties.template to point out that it's in an
external module
config/Openbravo.properties.template
legal/LAM_licenses.txt
lib/runtime/lam-client.jar
lib/runtime/ws-commons-util-1.0.1.jar
lib/runtime/xmlrpc-client-3.1.jar
lib/runtime/xmlrpc-common-3.1.jar
src/org/openbravo/authentication/lam/LamAuthenticationManager.java
--- a/config/Openbravo.properties.template	Tue Apr 19 18:37:03 2011 +0200
+++ b/config/Openbravo.properties.template	Wed Apr 20 11:19:04 2011 +0200
@@ -112,7 +112,9 @@
 ##################
 
 # Leave this empty to use the default login handler.
-# LAM server example: org.openbravo.authentication.lam.LamAuthenticationManager
+# Examples:
+# - org.openbravo.authentication.basic.AutologonAuthenticationManager (included)
+# - org.openbravo.authentication.lam.LamAuthenticationManager (in external 'LAM Authentication Manager' module)
 authentication.class=
 
 ###########
--- a/legal/LAM_licenses.txt	Tue Apr 19 18:37:03 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-A. LAM:
-
-All LAM code (LAM server, Java LAM binding, C# LAM binding, and Perl LAM
-binding), and lam-jsp sample code, and all the test code accompanying are
-licensed under OSL (Open Software License) version 2.1.
-
-A copy of OSL v. 2.1 can be found in the licenses directory inside this
-bundle. 
-It is also available online in http://opensource.osdir.com/licenses/osl-2.1.php 
-
-
-B. Dependencies:
-
-LAM utilizes many other open source packages. Some are included in this
-bundle, while others need to be downloaded and installed separately. All
-these dependency packages carry their original licenses. 
-
-Here are a list of open source packages included in this bundle, and their
-licenses:
-
-1. HTMLParser
-URL: http://htmlparser.sourceforge.net
-PATH: lam_kit/core/htmllexer.jar
-      lam_kit/core/htmlparser.jar
-License: LGPL v. 2.1
-
-A copy of LGPL v. 1.0 can be found in the licenses directory inside this
-bundle. 
-It is also available online in http://www.opensource.org/licenses/lgpl-license.php
-
-
-2. Junit
-URL: http://junit.sourceforge.net
-PATH: lam_kit/core/junit.jar
-License: CPL (Common Public License) version 1.0
-
-A copy of CPL v. 1.0 can be found in the licenses directory inside this
-bundle. 
-It is also available online in http://www.opensource.org/licenses/cpl1.0.php
-
-
-3. Servlet.jar 
-URL: http://java.sun.com/products/servlet/archive.html
-PATH: lam_lit/core/lib/servlet.jar
-License: Sun Binary Code License Agreement
-
-A copy of Sun Binary Code License Agreement can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://java.sun.com/products/servlet/LICENSE
-
-
-4. Apache Jakarta Commons Codec-1.3
-URL: http://jakarta.apache.org/commons/codec/api-release/index.html
-PATH: lam_kit/core/lib/commons-codec-1.3.jar
-License: Apache License version 2.0
-
-A copy of Apache License v. 2.0 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
-
-
-5. Apache Jakarta Commons httpclient
-URL: http://jakarta.apache.org/commons/httpclient/
-PATH: lam_kit/core/lib/commons-httpclient.jar
-License: Apache License version 2.0
-
-A copy of Apache License v. 2.0 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
-
-
-6. Apache Commons Logging
-URL: http://jakarta.apache.org/commons/logging/
-PATH: lam_kit/core/lib/commons-logging-1.1.jar
-      lam_kit/core/lib/commons-logging-adapters-1.1.jar
-      lam_kit/core/lib/commons-logging-api-1.1.jar
-License: Apache License version 2.0
-
-A copy of Apache License v. 2.0 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
-
-
-7. Apache Log4j
-URL: http://logging.apache.org/log4j/docs/
-PATH: lam_kit/core/lib/log4j-1.2.13.jar
-License: Apache License version 1.1
-
-A copy of Apache License v. 1.1 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
-
-
-8. Cas Server
-URL: http://www.ja-sig.org/products/cas/overview/
-PATH: lam_kit/core/lib/cas-server-3.0.5.jar
-      lam_kit/core/lib/cas-server-generic-3.0.5.jar
-License: JA-SIG Collaborative License
-
-A copy of JA-SIG Collaborative License can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.ja-sig.org/products/cas/overview/license/index.html
-
-
-9. Apache WS-commons-util
-URL: http://ws.apache.org/commons/
-PATH: lam_kit/core/lib/ws-commons-util-1.0.1.jar
-      lam_kit/samples/lam_jsp/WEB-INF/lib/ws-commons-util-1.0.1.jar
-License: Apache License version 2.0
-
-A copy of Apache License v. 2.0 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
-
-
-10. Apache XML-RPC
-URL: http://ws.apache.org/xmlrpc
-PATH: lam_kit/core/lib/xmlrpc-common-3.0.jar
-      lam_kit/core/lib/xmlrpc-client-3.0.jar
-      lam_kit/core/lib/xmlrpc-server-3.0.jar
-      lam_kit/samples/lam_jsp/WEB-INF/lib/xmlrpc-common-3.0.jar
-      lam_kit/samples/lam_jsp/WEB-INF/lib/xmlrpc-client-3.0.jar
-License: Apache License version 2.0
-
-A copy of Apache License v. 2.0 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
-
-
-11. PostgreSQLJDBC Driver
-URL: http://www.postgresql.org
-PATH: lam_kit/core/lib/jdbc3-postgresql
-License: BSD license
-
-A copy of PostgreSQL's BSD license can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://jdbc.postgresql.org/license.html
-
-
-C. Code Snippets
-
-LAM also includes some code taken from other projects. They also carry their
-original license and copyright.
-
-1. SecureUrl.java and ServiceTicketValidator.java
-Origin: Yale University
-PATH: lam_kit/core/src/com/spikesource/lam/bindings/SecureURL.java
-      lam_kit/core/src/com/spikesource/lam/bindings/ServiceTicketValidator.java
-License: BSD license
-
-A copy of Yale's BSD license can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://jdbc.postgresql.org/license.html
-
-
-2. MD5 code from Apache Commons
-Origin: Snippet was taken from POP3Client.java from Apache Commons-net 
-URL: http://www.devdaily.com/java/jwarehouse/commons-net-1.2.2/src/java/org/apache/commons/net/pop3/POP3Client.java.shtml
-PATH: lam_kit/core/src/com/spikesource/lam/xmlrpc/MD5.java
-License: Apache License version 2.0
-
-A copy of Apache License v. 2.0 can be found in the licenses 
-directory inside this bundle. It is also available online in
-http://www.opensource.org/licenses/apache2.0.php
Binary file lib/runtime/lam-client.jar has changed
Binary file lib/runtime/ws-commons-util-1.0.1.jar has changed
Binary file lib/runtime/xmlrpc-client-3.1.jar has changed
Binary file lib/runtime/xmlrpc-common-3.1.jar has changed
--- a/src/org/openbravo/authentication/lam/LamAuthenticationManager.java	Tue Apr 19 18:37:03 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- ************************************************************************************
- * Copyright (C) 2001-2009 Openbravo S.L.U.
- * Licensed under the Apache Software License version 2.0
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to  in writing,  software  distributed
- * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
- * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
- * specific language governing permissions and limitations under the License.
- ************************************************************************************
- */
-
-package org.openbravo.authentication.lam;
-
-import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.xmlrpc.XmlRpcException;
-import org.openbravo.authentication.AuthenticationData;
-import org.openbravo.authentication.AuthenticationException;
-import org.openbravo.authentication.AuthenticationManager;
-import org.openbravo.base.HttpBaseUtils;
-import org.openbravo.database.ConnectionProvider;
-
-import com.spikesource.lam.bindings.LamClient;
-
-/**
- * 
- * @author adrian
- */
-public class LamAuthenticationManager implements AuthenticationManager {
-
-  private ConnectionProvider conn = null;
-
-  /** Creates a new instance of LamAuthenticationManager */
-  public LamAuthenticationManager() {
-  }
-
-  public void init(HttpServlet s) throws AuthenticationException {
-
-    // TODO: Read LAM configuration.
-    if (s instanceof ConnectionProvider) {
-      conn = (ConnectionProvider) s;
-    } else {
-      throw new AuthenticationException("Connection provider required for LAM authentication");
-    }
-  }
-
-  public String authenticate(HttpServletRequest request, HttpServletResponse response)
-      throws AuthenticationException, ServletException, IOException {
-
-    try {
-      LamClient LC = new LamClient(); // TODO: configure LamClient
-
-      String sUserName = LC.force_authenticate(request, response);
-      if (sUserName == null || sUserName.equals("")) {
-        return null;
-      } else {
-        String sUserId = AuthenticationData.getUserId(conn, sUserName);
-        if ("-1".equals(sUserId)) {
-          throw new AuthenticationException("Authenticated user is not an Openbravo ERP user: "
-              + sUserName);
-        }
-        return sUserId;
-      }
-    } catch (XmlRpcException e) {
-      throw new ServletException("Cannot authenticate user.", e);
-    } catch (NoSuchAlgorithmException e) {
-      throw new ServletException("Cannot authenticate user.", e);
-    } catch (KeyManagementException e) {
-      throw new ServletException("Cannot authenticate user.", e);
-    }
-  }
-
-  public void logout(HttpServletRequest request, HttpServletResponse response)
-      throws ServletException, IOException {
-
-    try {
-      LamClient LC = new LamClient(); // TODO: configure LamClient
-      LC.logout(request, response, HttpBaseUtils.getLocalAddress(request) + "/security/Menu.html");
-    } catch (XmlRpcException e) {
-      throw new ServletException("Cannot close user session.", e);
-    }
-  }
-}
\ No newline at end of file