Log into the WAS Administrative Console and go to Security >Secure administration, applications, and infrastructure > Web security > Single sign-on (SSO)
Verify that both Interoperability Mode and Web inbound security attribute propagation are enabled
Open the wkplc.properties file and set values for following properties
# Defines the key which is used to enc
# sua_user does not need to match to a real user e.g use myname as
value
# sua_serversecret_password will be used as the key
sua_user=remembermeuser
sua_serversecret_password=remembermepassword
#Defines if Rememberme should be
authenticatoin
#
#
enable_rememberme=true
Execute the enable-stepup - authentication Configuration task by executing this command
ConfigEngine.bat enable-setup-aunthentication - DWasUserId =
Sample Remember Me cookie Portlet
This sample Portlet demonstrate how to use Remember Me cookie service to find out userId for
the user on anonymous page.
public class RememberMePortlet extends javax.portlet.GenericPortlet {
PortletServiceHome psh;
/**
* @see javax.portlet.Portlet#init()
*/
public void init() throws PortletException{
super.init();
try {
javax.naming.Context ctx = new javax.naming.InitialContext();
psh = (PortletServiceHome)ctx.lookup(RememberMeCookieService.JNDI_NAME);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException {
// Set the MIME type for the render response
response.setContentType(request.getResponseContentType());
try {
RememberMeCookieService rememberMeService =
psh.getPortletService(RememberMeCookieService.class);
if(rememberMeService.isRememberMeCookieEnabled()){
System.out.println("RememberMeCookie is enabled");
System.out.println("User Name " + rememberMeService.getUserID(request));
System.out.println("Is Remember Me Cookie Set " +
rememberMeService.isCookieSet(request));
response.getWriter().println("Invalidate remember me cookie");
}else{
System.out.println("RememberMeCookie is disabled");
}
} catch (SecurityException e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment