public class LDAPAuthenticationImpl extends InMemoryAbstractAuthentication implements IAuthentication
newSession(String, String, String, String)
is required for just about every Service available.IAuthentication.RunAsWork<Result>
Modifier and Type | Field and Description |
---|---|
protected LDAPConfig |
config |
Modifier and Type | Method and Description |
---|---|
void |
cleanupTickets()
Remove stored LDAP sessions older than expiration time span.
|
boolean |
containsTicket(java.lang.String ticket)
Determines whether the session ticket is active.
|
boolean |
endSession(java.lang.String ticket)
Ends the session for the given ticket.
|
AuthenticationResult |
getLoginTicket(java.lang.String superUserName,
java.lang.String password,
java.lang.String userName,
java.lang.String docBase)
Retrieve a user's login ticket via a superuser
|
java.lang.String |
getNewTicketId() |
java.lang.String |
getSessionForUser(java.lang.String userName)
This is for SSO by authenticating based on a user
|
UserBean |
getUserFromTicket(java.lang.String ticket)
Helper method to look up the UserBean for the ticket that is passed in
|
AuthenticationResult |
newSession(java.lang.String username,
java.lang.String password,
java.lang.String domain,
java.lang.String docbase)
Creates a new session for the input user
|
AuthenticationResult |
newSessionSimple(java.lang.String username,
java.lang.String password,
java.lang.String docbase)
A wrapper around the more complex
IAuthentication.newSession(String, String, String, String)
which omits the domain parameter. |
boolean |
removeTicket(java.lang.String ticket)
Remove an LDAP session.
|
<R> R |
runAsAdmin(IAuthentication.RunAsWork<R> runAsWork)
Unimplemented
|
java.lang.String |
runAsUser(java.lang.String userName)
This code is to be used extremely sparingly.
|
void |
setLdapConfig(LDAPConfig config) |
void |
setTicket(java.lang.String ticket,
UserBean userBean)
Store a new session.
|
boolean |
validateSession(java.lang.String ticket)
Validate Session checks ticket incase it is null or empty from the session
|
protected LDAPConfig config
public void setLdapConfig(LDAPConfig config)
public boolean endSession(java.lang.String ticket)
endSession
in interface IAuthentication
ticket
- The ticket to be removed from the service.IAuthentication.endSession(java.lang.String)
public AuthenticationResult newSession(java.lang.String username, java.lang.String password, java.lang.String domain, java.lang.String docbase)
newSession
in interface IAuthentication
username
- Username to be authenticatedpassword
- Password for the given usernamedomain
- This actually doesn't do anything for this implementation!docbase
- This isn't used either...IAuthentication.newSession(java.lang.String,
java.lang.String, java.lang.String, java.lang.String)
public AuthenticationResult newSessionSimple(java.lang.String username, java.lang.String password, java.lang.String docbase)
IAuthentication
IAuthentication.newSession(String, String, String, String)
which omits the domain parameter. An empty string is used for the domain.newSessionSimple
in interface IAuthentication
username
- usernamepassword
- passworddocbase
- name of docbaseAuthenticationResult
error
equals true if method failed, otherwise falseIAuthentication.newSessionSimple(java.lang.String,
java.lang.String, java.lang.String)
public boolean validateSession(java.lang.String ticket)
validateSession
in interface IAuthentication
ticket
- - The ticket string requiring validationIAuthentication.validateSession(java.lang.String)
public AuthenticationResult getLoginTicket(java.lang.String superUserName, java.lang.String password, java.lang.String userName, java.lang.String docBase)
IAuthentication
getLoginTicket
in interface IAuthentication
superUserName
- username of a superuser in the docbasepassword
- password for the superuser in the docbaseuserName
- user whose ticket is being retrieveddocBase
- name of docbaseAuthenticationResult
error
returns true if method failed, otherwise falsepublic void setTicket(java.lang.String ticket, UserBean userBean)
ticket
- Unique ticket that identifies this sessiondirectoryUrl
- URL of the active directoryjava.lang.IllegalArgumentException
- if the specified ticket already existspublic boolean removeTicket(java.lang.String ticket)
ticket
- Unique ticket that identifies this sessionpublic boolean containsTicket(java.lang.String ticket)
ticket
- the ticket we wish to validatepublic java.lang.String getNewTicketId()
public void cleanupTickets()
public UserBean getUserFromTicket(java.lang.String ticket)
getUserFromTicket
in class InMemoryAbstractAuthentication
ticket
- public <R> R runAsAdmin(IAuthentication.RunAsWork<R> runAsWork)
runAsAdmin
in interface IAuthentication
IAuthentication.runAsAdmin(com.tsgrp.opencontent.core.authentication.IAuthentication.RunAsWork)
public java.lang.String runAsUser(java.lang.String userName)
IAuthentication
runAsUser
in interface IAuthentication
public java.lang.String getSessionForUser(java.lang.String userName)
IAuthentication
getSessionForUser
in interface IAuthentication