public class DynamoAuthenticationImpl extends InMemoryAbstractAuthentication implements IAuthentication
IAuthentication.RunAsWork<Result>
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,UserBean> |
activeSessions |
protected long |
timeout |
Modifier | Constructor and Description |
---|---|
protected |
DynamoAuthenticationImpl() |
Modifier and Type | Method and Description |
---|---|
void |
cleanupTickets()
Cleans up ticket that are expired (24 hours expiration)
|
boolean |
containsTicket(java.lang.String ticket)
Checks if the current active session contains the ticket
|
boolean |
endSession(java.lang.String ticket)
Terminate the session with 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()
Creates a new ticket
|
java.lang.String |
getSessionForUser(java.lang.String userName)
Unimplemented TODO: Implement like we do in alfresco
|
UserBean |
getUserFromTicket(java.lang.String ticket)
Implemented in LDAPAuthenticationImpl.
|
AuthenticationResult |
newSession(java.lang.String userName,
java.lang.String password,
java.lang.String domain,
java.lang.String docbase)
Create a new ticket object used for connections to the docbase with the given credentials.
|
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)
Removes the ticket from the active session
|
<R> R |
runAsAdmin(IAuthentication.RunAsWork<R> runAsWork)
This code is to be used extremely sparingly.
|
java.lang.String |
runAsUser(java.lang.String userName)
This code is to be used extremely sparingly.
|
void |
setTicket(java.lang.String ticket,
UserBean userBean)
Sets the ticket in the active session
|
boolean |
validateSession(java.lang.String ticket)
Validate Session checks ticket in case it is null or empty from the session
If we're using DynamoAuthentication it actually checks our map to see if the
ticket exists
|
protected java.util.Map<java.lang.String,UserBean> activeSessions
@Value(value="${ticket.timeout}") protected long timeout
public boolean endSession(java.lang.String ticket)
IAuthentication
endSession
in interface IAuthentication
ticket
- a ticket obtained via IAuthentication.newSession(String, String, String, String)
or IAuthentication.newSessionSimple(String, String, String)
.IAuthentication.endSession(java.lang.String)
public AuthenticationResult newSession(java.lang.String userName, java.lang.String password, java.lang.String domain, java.lang.String docbase)
IAuthentication
newSession
in interface IAuthentication
userName
- usernamepassword
- passworddomain
- domain namedocbase
- name of docbaseAuthenticationResult
error
returns true if method failed, otherwise falseIAuthentication.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 falsecom.tsgrp.opencontent.core.authentication.IAuthentication#getLoginTicket(java
.lang.String, java.lang.String, java.lang.String, java.lang.String)
public <R> R runAsAdmin(IAuthentication.RunAsWork<R> runAsWork)
IAuthentication
runAsAdmin
in interface IAuthentication
IAuthentication.runAsAdmin(com.tsgrp.opencontent.core.authentication.IAuthentication.RunAsWork)
public UserBean getUserFromTicket(java.lang.String ticket)
InMemoryAbstractAuthentication
getUserFromTicket
in class InMemoryAbstractAuthentication
getUserFromTicket(java.lang.String)
public java.lang.String runAsUser(java.lang.String userName)
IAuthentication
runAsUser
in interface IAuthentication
com.tsgrp.opencontent.core.authentication.IAuthentication#runAsUser(java.lang
.String)
public java.lang.String getSessionForUser(java.lang.String userName)
getSessionForUser
in interface IAuthentication
IAuthentication.getSessionForUser(
java.lang.String)
public void setTicket(java.lang.String ticket, UserBean userBean)
{String}
- ticket{UserBean}
- userBeanpublic boolean removeTicket(java.lang.String ticket)
{String}
- ticketpublic boolean containsTicket(java.lang.String ticket)
{String}
- ticketpublic java.lang.String getNewTicketId()
public void cleanupTickets()