Foros de discusión
how to get current p_auth of a user?
lutz Bremen, modificado hace 12 años.
how to get current p_auth of a user?
Expert Mensajes: 291 Fecha de incorporación: 20/10/11 Mensajes recientes
hey guys,
i need to lnow hoe i can get the current p_auth token of the loged in user?
i want to add the command to a portlet and get it like this in a first step.
"
User ID: xxxxx
P auth token: xxxxxx
"
this should be show for every user.
thanks in advance
i need to lnow hoe i can get the current p_auth token of the loged in user?
i want to add the command to a portlet and get it like this in a first step.
"
User ID: xxxxx
P auth token: xxxxxx
"
this should be show for every user.
thanks in advance
Mani kandan, modificado hace 12 años.
RE: how to get current p_auth of a user?
Expert Mensajes: 492 Fecha de incorporación: 15/09/10 Mensajes recientes
Use the below code,
<%@ page import="javax.portlet.PortletRequest"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="com.liferay.portal.util.PortalUtil"%>
<%@ page import="com.liferay.portal.security.auth.AuthTokenUtil" %>
PortletRequest portletRequest =(PortletRequest)request.getAttribute("javax.portlet.request");
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(portletRequest));
String auth=AuthTokenUtil.getToken(httpReq);
//System.out.println("Auth #####"+auth);