Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.portal.portlet.service.impersonation
Interface ImpersonationService
- All Superinterfaces:
- PortletService
public interface ImpersonationService- extends PortletService
Portlet service for JSR compliant portlets to leverage the impersonation functionality of WebSphere Portal.
The following sample shows how to perform the JNDI lookup to acquire a service object:com.ibm.portal.portlet.service.PortletServiceHome psh; javax.naming.Context ctx = new javax.naming.InitialContext(); try { psh = (PortletServiceHome) ctx.lookup(ImpersonationService.JNDI_NAME); } catch(javax.naming.NameNotFoundException ex) { // error handling } // obtain the service object and use the service ImpersonationService impersonationService = (ImpersonationService) psh.getPortletService(ImpersonationService.class); try { impersonationService.doImpersonate(request, response, request.getParameter(FORM_TEXT)); } catch (Exception e) { // error handling }NOTE: This API may only be used in the scope of an HTTP request in WebSphere Portal, i.e. within a theme. The API can not be invoked directly by a custom servlet.
- Since:
- 6.1
Field Summary static java.lang.String JNDI_NAME
The name can be used to lookup theImpersonationService from JNDI
Method Summary void doImpersonate(javax.portlet.ActionRequest actionRequest, javax.portlet.ActionResponse actionResponse, java.lang.String impUserDN)
This method starts the impersonation.void doImpersonate(javax.portlet.ActionRequest actionRequest, javax.portlet.ActionResponse actionResponse, User impUser)
This method starts the impersonation.void doImpersonate(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse, java.lang.String impUserDN)
Deprecated. since 7.0 use doImpersonate(ActionRequest, ActionResponse, String) insteadvoid doImpersonate(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse, User impUser)
Deprecated. since 7.0 use doImpersonate(ActionRequest, ActionResponse, User) insteadUser getOriginalUser()
This method returns the original user that has logged in.boolean isUserImpersonated()
This method indicates whether the current user has been impersonated or he is acting on its own behalf.void loginOriginalUser(javax.portlet.ActionRequest aRequest, javax.portlet.ActionResponse aResponse)
This method ends the impersonation.void loginOriginalUser(javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse)
Deprecated. since 7.0 use com.ibm.portal.impersonation.ImpersonationService#loginOriginalUser(HttpServletRequest, HttpServletResponse) instead
Field Detail JNDI_NAME
static final java.lang.String JNDI_NAME
- The name can be used to lookup the
ImpersonationService from JNDI
- See Also:
- Constant Field Values
Method Detail doImpersonate
void doImpersonate(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse, java.lang.String impUserDN) throws ImpersonationException
- Deprecated. since 7.0 use doImpersonate(ActionRequest, ActionResponse, String) instead
- This method starts the impersonation. The already logged in user will impersonate the user given by impUserDN. The original user will be logged out. Nested impersonations are not supported, that is if the current user is already impersonated (isUserImpersonated() returns true), an ImpersonationExcetion will be thrown.
- Parameters:
- portletRequest - The current PortletRequest.
- portletResponse - The current PortletResponse.
- impUserDN - The user DN to be impersonated
- Throws:
- ImpersonationException - If impersonation fails, e.g. if the current user is already impersonated or does not have sufficient privileges to perform the impersonation.
doImpersonate
void doImpersonate(javax.portlet.ActionRequest actionRequest, javax.portlet.ActionResponse actionResponse, java.lang.String impUserDN) throws ImpersonationException
- This method starts the impersonation. The already logged in user will impersonate the user given by impUserDN. The original user will be logged out. Nested impersonations are not supported, that is if the current user is already impersonated (isUserImpersonated() returns true), an ImpersonationExcetion will be thrown.
- Parameters:
- actionRequest - The current ActionRequest.
- actionResponse - The current ActionResponse.
- impUserDN - The user DN to be impersonated
- Throws:
- ImpersonationException - If impersonation fails, e.g. if the current user is already impersonated or does not have sufficient privileges to perform the impersonation.
- Since:
- 7.0
doImpersonate
void doImpersonate(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse, User impUser) throws ImpersonationException
- Deprecated. since 7.0 use doImpersonate(ActionRequest, ActionResponse, User) instead
- This method starts the impersonation. The already logged in user will impersonate the specified user. The original user will be logged out. Nested impersonations are not supported, that is if the current user is already impersonated (isUserImpersonated() returns true), an ImpersonationExcetion will be thrown.
- Parameters:
- portletRequest - The current PortletRequest.
- portletResponse - The current PortletResponse.
- impUser - The user to be impersonated
- Throws:
- ImpersonationException - If impersonation fails, e.g. if the current user is already impersonated or does not have sufficient privileges to perform the impersonation.
doImpersonate
void doImpersonate(javax.portlet.ActionRequest actionRequest, javax.portlet.ActionResponse actionResponse, User impUser) throws ImpersonationException
- This method starts the impersonation. The already logged in user will impersonate the specified user. The original user will be logged out. Nested impersonations are not supported, that is if the current user is already impersonated (isUserImpersonated() returns true), an ImpersonationExcetion will be thrown.
- Parameters:
- actionRequest - The current ActionRequest.
- actionResponse - The current ActionResponse.
- impUser - The user to be impersonated
- Throws:
- ImpersonationException - If impersonation fails, e.g. if the current user is already impersonated or does not have sufficient privileges to perform the impersonation.
- Since:
- 7.0
loginOriginalUser
void loginOriginalUser(javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse) throws ImpersonationException
- Deprecated. since 7.0 use com.ibm.portal.impersonation.ImpersonationService#loginOriginalUser(HttpServletRequest, HttpServletResponse) instead
- This method ends the impersonation. The original user will be logged in.
- Parameters:
- servletRequest - The current HttpServletRequest.
- servletResponse - The current HttpServletResponse.
- Throws:
- ImpersonationException - If impersonation fails.
loginOriginalUser
void loginOriginalUser(javax.portlet.ActionRequest aRequest, javax.portlet.ActionResponse aResponse) throws ImpersonationException
- This method ends the impersonation. The original user will be logged in.
- Parameters:
- portletRequest - The current PortletRequest.
- portletResponse - The current PortletResponse.
- Throws:
- ImpersonationException - If impersonation fails.
- Since:
- 6.1.0.1
isUserImpersonated
boolean isUserImpersonated() throws ImpersonationException
- This method indicates whether the current user has been impersonated or he is acting on its own behalf.
- Returns:
- true if the current user has been impersonated by another user, false otherwise.
- Throws:
- ImpersonationException - if impersonation status could not be determined.
- Since:
- 6.1.0.1
getOriginalUser
User getOriginalUser() throws ImpersonationException
- This method returns the original user that has logged in. If no impersonation has been executed, this is the current user. If an impersonation has been executed, the original user that is returned is the one who initiated the impersonation and who will be logged in when #loginOriginalUser(PortletRequest, PortletResponse) is be called.
- Returns:
- the original user that has logged in and potentially impersonated another user.
- Throws:
- ImpersonationException - if the original user could not be determined.
- Since:
- 6.1.0.1
- See Also:
- isUserImpersonated() to evaluate if impersonation has been executed
Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD