|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.web.app.servlet.AuthenticationHelper
public final class AuthenticationHelper
Helper to authenticate the current user using available Ticket information.
User information is looked up in the Session. If found the ticket is retrieved and validated. If the ticket is invalid then a redirect is performed to the login page.
If no User info is found then a search will be made for a previous username stored in a Cookie value. If the username if found then a redirect to the Login page will occur. If no username is found then Guest access login will be attempted by the system. Guest access can be forced with the appropriate method call.
Field Summary | |
---|---|
static java.lang.String |
AUTHENTICATION_USER
session variables |
static java.lang.String |
LOGIN_BEAN
JSF bean IDs |
static java.lang.String |
SESSION_INVALIDATED
|
static java.lang.String |
SESSION_USERNAME
|
Constructor Summary | |
---|---|
AuthenticationHelper()
|
Method Summary | |
---|---|
static AuthenticationStatus |
authenticate(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
boolean forceGuest)
Helper to authenticate the current user using session based Ticket information. |
static AuthenticationStatus |
authenticate(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
boolean forceGuest,
boolean allowGuest)
Helper to authenticate the current user using session based Ticket information. |
static AuthenticationStatus |
authenticate(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
java.lang.String ticket)
Helper to authenticate the current user using the supplied Ticket value. |
static javax.servlet.http.Cookie |
getAuthCookie(javax.servlet.http.HttpServletRequest httpRequest)
Helper to return the Alfresco auth cookie. |
static java.lang.String |
getAuthCookieValue(javax.servlet.http.Cookie authCookie)
Gets the decoded auth cookie value. |
static java.lang.String |
getRemoteUser(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest httpRequest)
Uses the remote user mapper, if one is configured, to extract a user ID from the request |
static User |
getUser(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Attempts to retrieve the User object stored in the current session. |
static User |
portalGuestAuthenticate(org.springframework.web.context.WebApplicationContext ctx,
org.alfresco.service.cmr.security.AuthenticationService auth)
For no previous authentication or forced Guest - attempt Guest access |
static void |
setupThread(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
boolean useInterfaceLanguage)
Does all the stuff you need to do after successfully authenticating/validating a user ticket to set up the request thread. |
static User |
setUser(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest req,
java.lang.String currentUsername,
java.lang.String ticket,
boolean externalAuth)
Creates an object for an authenticated user and stores it in the session. |
static void |
setUsernameCookie(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse,
java.lang.String username)
Setup the Alfresco auth cookie value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String AUTHENTICATION_USER
public static final java.lang.String SESSION_USERNAME
public static final java.lang.String SESSION_INVALIDATED
public static final java.lang.String LOGIN_BEAN
Constructor Detail |
---|
public AuthenticationHelper()
Method Detail |
---|
public static void setupThread(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean useInterfaceLanguage)
sc
- the servlet contextreq
- the requestres
- the responsepublic static AuthenticationStatus authenticate(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean forceGuest) throws java.io.IOException
User information is looked up in the Session. If found the ticket is retrieved and validated. If no User info is found or the ticket is invalid then a redirect is performed to the login page.
forceGuest
- True to force a Guest login attempt
java.io.IOException
public static AuthenticationStatus authenticate(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean forceGuest, boolean allowGuest) throws java.io.IOException
User information is looked up in the Session. If found the ticket is retrieved and validated. If no User info is found or the ticket is invalid then a redirect is performed to the login page.
forceGuest
- True to force a Guest login attemptallowGuest
- True to allow the Guest user if no user object represent
java.io.IOException
public static AuthenticationStatus authenticate(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, java.lang.String ticket) throws java.io.IOException
java.io.IOException
public static User setUser(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest req, java.lang.String currentUsername, java.lang.String ticket, boolean externalAuth)
context
- the servlet contextreq
- the requestcurrentUsername
- the current user nameticket
- a validated ticketexternalAuth
- was this user authenticated externally?
public static User portalGuestAuthenticate(org.springframework.web.context.WebApplicationContext ctx, org.alfresco.service.cmr.security.AuthenticationService auth)
ctx
- WebApplicationContextauth
- AuthenticationServicepublic static java.lang.String getRemoteUser(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest httpRequest)
sc
- the servlet contexthttpRequest
- The HTTP request
null
otherwise.public static User getUser(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
sc
- the servlet contexthttpRequest
- The HTTP requesthttpResponse
- The HTTP response
public static void setUsernameCookie(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, java.lang.String username)
httpRequest
- httpResponse
- username
- public static javax.servlet.http.Cookie getAuthCookie(javax.servlet.http.HttpServletRequest httpRequest)
httpRequest
-
public static java.lang.String getAuthCookieValue(javax.servlet.http.Cookie authCookie)
authCookie
- the auth cookie
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |