6.1.2 Accessing SRPrincipal via Login Listener
You can modify the SRPrincipal object created after form-based sign-on to set user-specific properties, which you can later access in VPM script, etc. See Accessing SRPrincipal in Script and HTTP Request, Session, and Principal in Report Scripting.
To modify the SRPrincipal object when using form-based SSO, implement a LoginListener to be called at the time the user is authenticated (whether during live login or scheduled task). Follow the steps below:
1. Implement the inetsoft.sree.security.LoginListener interface's single method userLogin(LoginEvent). Use LoginEvent.getPrincipal() to obtain the SRPrincipal object, and SRPrincipal.setProperty() to assign a custom property. For example:
import inetsoft.sree.security.*;
public class MyLoginListener implements LoginListener {
public void userLogin(LoginEvent event) {
SRPrincipal prin = event.getPrincipal();
prin.setProperty("myprop", "myval");
}
}
Note: To customize the “Welcome” text displayed in the default portal, call SRPrincipal.setAlias("Alternate Name").
2. In the sree.propeties file, set property sree.security.listeners to a comma-separated list of your fully qualified LoginListener class names. For example:
sree.security.listeners=MyLoginListener
See Accessing SRPrincipal in Script for information on accessing an SRPrincipal property (default or custom) in script.
See Also
Form-Based Single Sign-On, for instructions on configuring form-based SSO.
| << 6.1.1 Accessing SRPrincipal in Custom JSP/Servlets | © 1996-2013 InetSoft Technology Corporation (v11.4) | 6.1.3 Accessing SRPrincipal in Script >> |