Package org.apache.ofbiz.ldap.commons
Class AbstractOFBizAuthenticationHandler
java.lang.Object
org.apache.ofbiz.ldap.commons.AbstractOFBizAuthenticationHandler
- All Implemented Interfaces:
InterfaceOFBizAuthenticationHandler
- Direct Known Subclasses:
OFBizActiveDirectoryAuthenticationHandler
,OFBizCasAuthenticationHandler
,OFBizLdapAuthenticationHandler
public abstract class AbstractOFBizAuthenticationHandler
extends Object
implements InterfaceOFBizAuthenticationHandler
The abstract Authentication Handler.
The ACL of a user is still controlled by OFBiz.
-
Constructor Summary
ConstructorDescriptionPublic constructor, initializes some required member variables. -
Method Summary
Modifier and TypeMethodDescriptionabstract SearchResult
getLdapSearchResult
(String username, String password, Element rootElement, boolean bindRequired) Get LDAP search result from a username, password and configuration.getPartyId
(Element rootElement, SearchResult result) Get the party id of a user.getSecurityGroup
(Element rootElement, SearchResult result) Get the security group of a user.boolean
hasLdapLoggedOut
(HttpServletRequest request, HttpServletResponse response, Element rootElement) An HTTP WebEvent handler that checks to see is a userLogin is logged out.login
(HttpServletRequest request, HttpServletResponse response, String username, String password, Element rootElement, SearchResult result) Login string.login
(HttpServletRequest request, HttpServletResponse response, Element rootElement) Login a user.logout
(HttpServletRequest request, HttpServletResponse response, Element rootElement) Logout a user.
-
Constructor Details
-
AbstractOFBizAuthenticationHandler
public AbstractOFBizAuthenticationHandler()Public constructor, initializes some required member variables.
-
-
Method Details
-
getPartyId
Description copied from interface:InterfaceOFBizAuthenticationHandler
Get the party id of a user.- Specified by:
getPartyId
in interfaceInterfaceOFBizAuthenticationHandler
- Parameters:
rootElement
- Element root element of ldap config fileresult
- SearchResult- Returns:
- the PartyId object.
-
getSecurityGroup
Description copied from interface:InterfaceOFBizAuthenticationHandler
Get the security group of a user.- Specified by:
getSecurityGroup
in interfaceInterfaceOFBizAuthenticationHandler
- Parameters:
rootElement
- Element root element of ldap config fileresult
- SearchResult- Returns:
- the SecurityGroup object.
-
login
public String login(HttpServletRequest request, HttpServletResponse response, Element rootElement) throws Exception Description copied from interface:InterfaceOFBizAuthenticationHandler
Login a user.- Specified by:
login
in interfaceInterfaceOFBizAuthenticationHandler
- Parameters:
request
- HttpServletRequestresponse
- HttpServletResponserootElement
- Element root element of ldap config file- Returns:
- success if the user can login successfully; otherwise, error.
- Throws:
Exception
-
logout
Description copied from interface:InterfaceOFBizAuthenticationHandler
Logout a user.- Specified by:
logout
in interfaceInterfaceOFBizAuthenticationHandler
- Parameters:
request
- HttpServletRequestresponse
- HttpServletResponserootElement
- Element root element of ldap config file- Returns:
- success if the user can login successfully; otherwise, error.
-
getLdapSearchResult
public abstract SearchResult getLdapSearchResult(String username, String password, Element rootElement, boolean bindRequired) throws NamingException Description copied from interface:InterfaceOFBizAuthenticationHandler
Get LDAP search result from a username, password and configuration.- Specified by:
getLdapSearchResult
in interfaceInterfaceOFBizAuthenticationHandler
- Parameters:
username
- Stringpassword
- StringrootElement
- Element root element of ldap config filebindRequired
- boolean if true, bind; false, just search the user in LDAP- Returns:
- result SearchResult if ldap search successfully; otherwise, null.
- Throws:
NamingException
-
login
public String login(HttpServletRequest request, HttpServletResponse response, String username, String password, Element rootElement, SearchResult result) throws Exception Login string.- Parameters:
request
- the requestresponse
- the responseusername
- the usernamepassword
- the passwordrootElement
- the root elementresult
- the result- Returns:
- the string
- Throws:
Exception
- the exception
-
hasLdapLoggedOut
public boolean hasLdapLoggedOut(HttpServletRequest request, HttpServletResponse response, Element rootElement) An HTTP WebEvent handler that checks to see is a userLogin is logged out. If yes, the user is forwarded to the login page.- Specified by:
hasLdapLoggedOut
in interfaceInterfaceOFBizAuthenticationHandler
- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.rootElement
- Element root element of ldap config file- Returns:
- true if the user has logged out from ldap; otherwise, false.
-