Removed jaas login module and configuration as it is not needed
authorChristos V. Stathis <chstath@ebs.gr>
Thu, 24 Feb 2011 14:43:53 +0000 (16:43 +0200)
committerChristos V. Stathis <chstath@ebs.gr>
Thu, 24 Feb 2011 14:43:53 +0000 (16:43 +0200)
jboss-config/5.1.0/conf/login-config.xml
src/gr/ebs/gss/server/webdav/login/GssWebDAVLoginModule.java [deleted file]
webdav/WEB-INF/jboss-web.xml [deleted file]

index de97f55..804e1a6 100644 (file)
@@ -142,20 +142,5 @@ $Revision: 87078 $
         flag="required"/>
        </authentication>
     </application-policy>
-       
-       <application-policy name="gssWebDAVSecurity">
-       <authentication>
-          <login-module code="gr.ebs.gss.server.webdav.login.GssWebDAVLoginModule"
-             flag="required">
-             <module-option name="unauthenticatedIdentity">guest</module-option>
-             <module-option name="hashAlgorithm">MD5</module-option>
-           <module-option name="hashEncoding">rfc2617</module-option>
-           <module-option name="hashUserPassword">false</module-option>
-           <module-option name="hashStorePassword">true</module-option>
-           <module-option name="passwordIsA1Hash">false</module-option>
-           <module-option name="storeDigestCallback">org.jboss.security.auth.spi.RFC2617Digest</module-option>
-          </login-module>
-       </authentication>
-    </application-policy>
 </policy>
 
diff --git a/src/gr/ebs/gss/server/webdav/login/GssWebDAVLoginModule.java b/src/gr/ebs/gss/server/webdav/login/GssWebDAVLoginModule.java
deleted file mode 100644 (file)
index fdcd3c6..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*\r
- * Copyright 2005, 2008, 2009 Electronic Business Systems Ltd.\r
- *\r
- * This file is part of GSS.\r
- *\r
- * GSS is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * GSS is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with GSS.  If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package gr.ebs.gss.server.webdav.login;\r
-\r
-import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration;\r
-import gr.ebs.gss.client.exceptions.RpcException;\r
-import gr.ebs.gss.server.domain.User;\r
-import gr.ebs.gss.server.domain.UserLogin;\r
-import gr.ebs.gss.server.ejb.ExternalAPI;\r
-import gr.ebs.gss.server.ejb.TransactionHelper;\r
-\r
-import java.io.UnsupportedEncodingException;\r
-import java.security.Principal;\r
-import java.security.acl.Group;\r
-import java.util.Date;\r
-import java.util.HashSet;\r
-import java.util.concurrent.Callable;\r
-\r
-import javax.naming.Context;\r
-import javax.naming.InitialContext;\r
-import javax.naming.NamingException;\r
-import javax.rmi.PortableRemoteObject;\r
-import javax.security.auth.login.FailedLoginException;\r
-import javax.security.auth.login.LoginException;\r
-\r
-import org.apache.commons.codec.binary.Base64;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.jboss.security.auth.spi.UsernamePasswordLoginModule;\r
-\r
-\r
-/**\r
- * The custom login module for the GSS WebDAV implementation.\r
- */\r
-public class GssWebDAVLoginModule extends UsernamePasswordLoginModule {\r
-\r
-       /**\r
-        * Logger for this class\r
-        */\r
-       private static final Log logger = LogFactory.getLog(GssWebDAVLoginModule.class);\r
-\r
-       /**\r
-        * A helper method that retrieves a reference to the ExternalAPI bean and\r
-        * stores it for future use.\r
-        *\r
-        * @return an ExternalAPI instance\r
-        * @throws RpcException in case an error occurs\r
-        */\r
-       private ExternalAPI getService() throws RpcException {\r
-               try {\r
-                       final Context ctx = new InitialContext();\r
-                       final Object ref = ctx.lookup(getConfiguration().getString("externalApiPath"));\r
-                       return (ExternalAPI) PortableRemoteObject.narrow(ref, ExternalAPI.class);\r
-               } catch (final NamingException e) {\r
-                       logger.error("Unable to retrieve the ExternalAPI EJB", e);\r
-                       throw new RpcException("An error occurred while contacting the naming service");\r
-               }\r
-       }\r
-\r
-       @Override\r
-       protected String getUsersPassword() throws LoginException {\r
-               String username = getUsername();\r
-               try {\r
-                       final User user = getService().findUser(username);\r
-                       if (user == null) throw new FailedLoginException("User '" + username + "' not found.");\r
-                       if (!user.isActive()) throw new FailedLoginException("User '" + username + "' is disabled.");\r
-                       if (user.getWebDAVPassword() != null && user.getWebDAVPassword().length() > 0)\r
-                               return user.getWebDAVPassword();\r
-                       // If no password has ever been generated, use token instead\r
-                       String tokenEncoded = new String(Base64.encodeBase64(user.getAuthToken()), "US-ASCII");\r
-                       user.setWebDAVPassword(tokenEncoded);\r
-                       new TransactionHelper<Void>().tryExecute(new Callable<Void>() {\r
-                               @Override\r
-                               public Void call() throws Exception {\r
-                                       getService().updateUser(user);\r
-                                       return null;\r
-                               }\r
-                       });\r
-                       return tokenEncoded;\r
-               } catch (RpcException e) {\r
-                       String error = "An error occurred while communicating with the service";\r
-                       logger.error(error, e);\r
-                       throw new LoginException(e.getMessage());\r
-               } catch (UnsupportedEncodingException e) {\r
-            logger.error("", e);\r
-            throw new LoginException(e.getMessage());\r
-               } catch (Exception e) {\r
-            logger.error("", e);\r
-                       throw new LoginException(e.getMessage());\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Overrides parent's implementation by returning only the simpleUser\r
-        * role for any successful login.\r
-        *\r
-        * @return Group[] that contains only the authenticatedUser group (role)\r
-        * @throws LoginException\r
-        * @see org.jboss.security.auth.spi.AbstractServerLoginModule#getRoleSets()\r
-        */\r
-       @Override\r
-       protected Group[] getRoleSets() throws LoginException {\r
-               Principal principal;\r
-               try {\r
-                       principal = createIdentity("simpleUser");\r
-               } catch (Exception e) {\r
-                       logger.error("", e);\r
-                       throw new LoginException(e.getMessage());\r
-               }\r
-               Group rolesGroup = null;\r
-               rolesGroup = createGroup("Roles", new HashSet());\r
-               rolesGroup.addMember(principal);\r
-               Group[] roles = new Group[1];\r
-               roles[0] = rolesGroup;\r
-               // Update the last login.\r
-               //TODO: Handle the userlogins via WebDAV\r
-//             try {\r
-//                     new TransactionHelper<Void>().tryExecute(new Callable<Void>() {\r
-//                             @Override\r
-//                             public Void call() throws Exception {\r
-//                                     User user = getService().findUser(getUsername());\r
-//                                     UserLogin userLogin = new UserLogin();\r
-//                                     userLogin.setLoginDate(new Date());\r
-//                                     getService().addUserLogin(userLogin);\r
-//                                     getService().updateUser(user);\r
-//                                     return null;\r
-//                             }\r
-//                     });\r
-//             } catch (Exception e) {\r
-//                     logger.error("", e);\r
-//                     throw new LoginException(e.getMessage());\r
-//             }\r
-               return roles;\r
-       }\r
-\r
-}\r
diff --git a/webdav/WEB-INF/jboss-web.xml b/webdav/WEB-INF/jboss-web.xml
deleted file mode 100644 (file)
index 43d37af..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>\r
-\r
-<jboss-web>\r
-  <!-- Specify the security domain for authentication/authorization and\r
-   require that the domain's cache be flushed when the session invalidates.\r
-   -->\r
-   <security-domain flushOnSessionInvalidation="true">\r
-       java:/jaas/gssWebDAVSecurity\r
-   </security-domain>\r
-</jboss-web>\r