diff --git a/ldap/src/org/ofbiz/ldap/LdapLoginWorker.java b/ldap/src/org/ofbiz/ldap/LdapLoginWorker.java index f2caf7866..1f1d0633a 100644 --- a/ldap/src/org/ofbiz/ldap/LdapLoginWorker.java +++ b/ldap/src/org/ofbiz/ldap/LdapLoginWorker.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. 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 @@ -259,6 +259,6 @@ public class LdapLoginWorker extends LoginWorker { } } - return rootElement; + return rootElement; } } diff --git a/ldap/src/org/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java b/ldap/src/org/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java index 4c6cafc68..7ec59fa8b 100644 --- a/ldap/src/org/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java +++ b/ldap/src/org/ofbiz/ldap/activedirectory/OFBizActiveDirectoryAuthenticationHandler.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. 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 @@ -37,17 +37,17 @@ import org.w3c.dom.Element; /** * The OFBiz ActiveDirectory Authentication Handler.
- * + * * The ACL of a user is still controlled by OFBiz. * */ public final class OFBizActiveDirectoryAuthenticationHandler extends AbstractOFBizAuthenticationHandler { /** - * Public constructor, initializes some required member variables.
+ * Public constructor, initializes some required member variables.
*/ public OFBizActiveDirectoryAuthenticationHandler() { - + } public SearchResult getLdapSearchResult(String username, String password, @@ -111,8 +111,8 @@ public final class OFBizActiveDirectoryAuthenticationHandler extends AbstractOFB // No ldap service found, or cannot login. throw new NamingException(e.getLocalizedMessage()); } - + return result; } - + } diff --git a/ldap/src/org/ofbiz/ldap/cas/OFBizCasAuthenticationHandler.java b/ldap/src/org/ofbiz/ldap/cas/OFBizCasAuthenticationHandler.java index deb2e8b13..d809638bb 100644 --- a/ldap/src/org/ofbiz/ldap/cas/OFBizCasAuthenticationHandler.java +++ b/ldap/src/org/ofbiz/ldap/cas/OFBizCasAuthenticationHandler.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. 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 @@ -38,32 +38,32 @@ import org.w3c.dom.Element; /** * The OFBiz CAS-LDAP Authentication Handler.
- * + * * The ACL of a user is still controlled by OFBiz. * */ public final class OFBizCasAuthenticationHandler extends AbstractOFBizAuthenticationHandler { public static final String PARAM_TICKET = "ticket"; - + public static final String PARAM_SERVICE = "service"; - + public static final String PARAM_RENEW = "renew"; /** - * Public constructor, initializes some required member variables.
+ * Public constructor, initializes some required member variables.
*/ public OFBizCasAuthenticationHandler() { - + } - - + + public String login(HttpServletRequest request, HttpServletResponse response, Element rootElement) throws Exception { String ticket = request.getParameter(PARAM_TICKET); String username = request.getParameter("USERNAME"); String password = request.getParameter("PASSWORD"); - + String casUrl = UtilXml.childElementValue(rootElement, "CasUrl", "https://localhost:8443/cas"); String loginUri = UtilXml.childElementValue(rootElement, "CasLoginUri", "/login"); String validateUri = UtilXml.childElementValue(rootElement, "CasValidateUri", "/validate"); @@ -106,7 +106,7 @@ public final class OFBizCasAuthenticationHandler extends AbstractOFBizAuthentica } } } - + if (casLoggedIn && username != null) { // as we cannot get the password user input in CAS login page, we use a random one password = randomString(); diff --git a/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java b/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java index 688b7d793..f670ad5ad 100644 --- a/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java +++ b/ldap/src/org/ofbiz/ldap/commons/AbstractOFBizAuthenticationHandler.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. 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 @@ -48,7 +48,7 @@ import org.w3c.dom.Element; /** * The abstract Authentication Handler. - * + * * The ACL of a user is still controlled by OFBiz.
* */ @@ -58,9 +58,9 @@ public abstract class AbstractOFBizAuthenticationHandler implements InterfaceOFB * Public constructor, initializes some required member variables.
*/
public AbstractOFBizAuthenticationHandler() {
-
+
}
-
+
public Object getPartyId(Element rootElement, SearchResult result) {
Object partyId = UtilXml.childElementValue(rootElement, "AutoPartyId", "admin");
return partyId;
@@ -75,14 +75,14 @@ public abstract class AbstractOFBizAuthenticationHandler implements InterfaceOFB
String username = request.getParameter("USERNAME");
String password = request.getParameter("PASSWORD");
-
+
SearchResult result = getLdapSearchResult(username, password, rootElement, true);
if (result != null) {
return login(request, response, username, password, rootElement, result);
}
return "error";
}
-
+
public String logout(HttpServletRequest request, HttpServletResponse response, Element rootElement) {
return "success";
}
@@ -91,7 +91,7 @@ public abstract class AbstractOFBizAuthenticationHandler implements InterfaceOFB
public String login(HttpServletRequest request, HttpServletResponse response, String username, String password, Element rootElement, SearchResult result) throws Exception {
HttpSession session = request.getSession();
-
+
// get the visit id to pass to the userLogin for history
String visitId = VisitHandler.getVisitId(session);
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
@@ -111,7 +111,7 @@ public abstract class AbstractOFBizAuthenticationHandler implements InterfaceOFB
} catch (GenericEntityException e) {
throw new GenericEntityException(e.getLocalizedMessage());
}
-
+
GenericValue userLoginSecurityGroup = delegator.makeValue("UserLoginSecurityGroup", UtilMisc.toMap("userLoginId", username, "groupId", getSecurityGroup(rootElement, result), "fromDate", UtilDateTime.nowTimestamp()));
try {
userLoginSecurityGroup.create();
@@ -122,7 +122,7 @@ public abstract class AbstractOFBizAuthenticationHandler implements InterfaceOFB
userTryToLogin.setString("currentPassword", useEncryption ? HashCrypt.getDigestHash(password, LoginServices.getHashType()) : password);
userTryToLogin.store();
}
-
+
Map
- *
+ *
*/
public interface InterfaceOFBizAuthenticationHandler {
/**
* Login a user.
- *
+ *
* @param request HttpServletRequest
* @param response HttpServletResponse
* @param rootElement Element root element of ldap config file
- *
+ *
* @return success if the user can login successfully; otherwise, error.
- * @throws Exception
+ * @throws Exception
*/
String login(HttpServletRequest request, HttpServletResponse response, Element rootElement) throws Exception;
-
+
/**
* Get the security group of a user.
- *
+ *
* @param rootElement Element root element of ldap config file
* @param result SearchResult
- *
+ *
* @return the SecurityGroup object.
*/
Object getSecurityGroup(Element rootElement, SearchResult result);
-
+
/**
* Get the party id of a user.
- *
+ *
* @param rootElement Element root element of ldap config file
* @param result SearchResult
- *
+ *
* @return the PartyId object.
*/
Object getPartyId(Element rootElement, SearchResult result);
/**
* Logout a user.
- *
+ *
* @param request HttpServletRequest
* @param response HttpServletResponse
* @param rootElement Element root element of ldap config file
- *
+ *
* @return success if the user can login successfully; otherwise, error.
- * @throws Exception
+ * @throws Exception
*/
String logout(HttpServletRequest request, HttpServletResponse response, Element rootElement);
-
+
/**
* Get LDAP search result from a username, password and configuration.
- *
+ *
* @param username String
* @param password String
* @param rootElement Element root element of ldap config file
* @param bindRequired boolean if true, bind; false, just search the user in LDAP
- *
+ *
* @return result SearchResult if ldap search successfully; otherwise, null.
- * @throws Exception
+ * @throws Exception
*/
SearchResult getLdapSearchResult(String username, String password, Element rootElement, boolean bindRequired) throws NamingException;
diff --git a/ldap/src/org/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java b/ldap/src/org/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java
index b3261785c..224b96aa0 100644
--- a/ldap/src/org/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java
+++ b/ldap/src/org/ofbiz/ldap/openldap/OFBizLdapAuthenticationHandler.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. 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
@@ -34,14 +34,14 @@ import org.w3c.dom.Element;
/**
* The OFBiz LDAP Authentication Handler.
- *
+ *
* The ACL of a user is still controlled by OFBiz.
*
*/
public final class OFBizLdapAuthenticationHandler extends AbstractOFBizAuthenticationHandler {
/**
- * Public constructor, initializes some required member variables.
+ * Public constructor, initializes some required member variables.
*/
public OFBizLdapAuthenticationHandler() {