HTML and CSS Reference
In-Depth Information
Table 12-1 shows WeatherRealm configuration properties.
Table 12-1. Custom Realm Configuration Properties
Property
Value
JAAS Context
jdbcRealm
JNDI
jdbc/weatherDB
User Table
WEATHER.APP_USER
User Name Column
ID
Password Column
PASSWORD
Group Table
WEATHER.APP_GROUP
Group Table User Name Column
USERID
Group Name Column
GROUPID
Password Encryption Algorithm
None
Assign Groups
[Leave this field blank]
Database User
Weather
Database Password
Password
Digest Algorithm
None
Encoding
[Leave this field blank]
Charset
[Leave this field blank]
Now, we configured container-managed security for the Weather Application , so we should remove
AuthorizationListener class and its reference from faces-config.xml . WeatherBacking class has to be updated as
well. Listing 12-7 shows the updated WeatherBacking managed bean.
Listing 12-7. Updated WeatherBacking Class
@Named
@RequestScoped
public class WeatherBacking extends BaseBacking {
@EJB
private UserManagerLocal userManager;
@PostConstruct
public void loadUser(ComponentSystemEvent event) {
try {
String userID = getRequest().getUserPrincipal().getName();
AppUser sourceAppUser = userManager.getUser(userID);
AppUser targetAppUser = (AppUser) evaluateEL("#{appUser}", AppUser.class);
targetAppUser.setFirstName(sourceAppUser.getFirstName());
targetAppUser.setLastName(sourceAppUser.getLastName());
targetAppUser.setZipCode(sourceAppUser.getZipCode());
 
 
Search WWH ::




Custom Search