HTML and CSS Reference
In-Depth Information
The main methods of UserSearchBacking CDI bean are as follows:
retrieveUserList : Calls retrieveMegaUsers method of UserManager EJB. If results returned
successfully, a message with the number of returned users is displayed to the user including
the users list (administrator and users).
deleteUser : Calls removeMegaUser method of UserManager EJB passing the currently
selected user ID (using currentSelectedUser.getId() ) as a parameter. If the user is deleted
successfully, the following "User deleted successfully" will be displayed to the user.
Mega App uses CDI version 1.1, and Listing 13-34 shows the application's bean.xml file under WEB-INF folder.
Listing 13-34. Mega App beans.xml File
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://xmlns.jcp.org/xml/ns/javaee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation=" http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd "
version="1.1" bean-discovery-mode="annotated">
</beans>
Applying Security
In Mega App, we have implemented container-managed security for application authentication, and page authorization.
Listing 13-35 shows the Mega App security constraints which are defined in the application web.xml file.
Listing 13-35. Mega App Security Constraints
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns=" http://xmlns.jcp.org/xml/ns/javaee "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation=" http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "
version="3.1">
...
<security-constraint>
<display-name>securityConstraint1</display-name>
<web-resource-collection>
<web-resource-name>resources</web-resource-name>
<description/>
<url-pattern>/protected/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>megaAppUser</role-name>
<role-name>megaAppAdmin</role-name>
</auth-constraint>
</security-constraint>
 
Search WWH ::




Custom Search