6.1.1 Accessing SRPrincipal in Custom JSP/Servlets

The SRPrincipal object can be accessed from the HttpSession object within a custom JSP or Servlet. You can add or set the properties of the SRPrincipal object using the setProperty() method.

<%@ page import="inetsoft.sree.security.*, inetsoft.sree.RepletRepository" %>

<%

SRPrincipal p;

p = (SRPrincipal) session.getAttribute(RepletRepository.PRINCIPAL_COOKIE);

if(p == null) {

   p = new SRPrincipal();

}

 

// setting a custom property

p.setProperty("property_name", "property_value");

 

// setting the locale using the locale string

p.setLocale(new Locale("en","US"));

 

session.setAttribute(RepletRepository.PRINCIPAL_COOKIE, p);

%>

<< 6.1 Accessing the SRPrincipal Object © 1996-2013 InetSoft Technology Corporation (v11.5) 6.1.2 Accessing SRPrincipal via Login Listener >>