Class SecurePingEJB
- java.lang.Object
-
- info.ejava.examples.secureping.ejb.SecurePingEJB
-
- All Implemented Interfaces:
SecurePing,SecurePingLocal,SecurePingRemote
public class SecurePingEJB extends Object implements SecurePingRemote, SecurePingLocal
This session bean provides several methods; each of which will require some type of role associated with the user in order to successfully invoke them.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) SessionContextctxprivate static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description SecurePingEJB()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private StringgetInfo(String prefix)This method creates a status string based on security information obtained from the SessionContext.voidinit()booleanisCallerInRole(String role)This method allows the RMI Test to check whether the current subject has a specific role.StringpingAdmin()Callers of this method must have the "admin" role.StringpingAll()This method is permitted to be called by anyone.StringpingExcluded()No one should be allowed to call this method.StringpingUser()Callers of this method must have the "user" role.StringwhoAmI()
-
-
-
Field Detail
-
logger
private static final org.slf4j.Logger logger
-
ctx
SessionContext ctx
-
-
Method Detail
-
init
@PostConstruct public void init()
-
getInfo
private String getInfo(String prefix)
This method creates a status string based on security information obtained from the SessionContext.
-
pingAll
@PermitAll public String pingAll()
This method is permitted to be called by anyone.- Specified by:
pingAllin interfaceSecurePing
-
pingUser
@RolesAllowed("user") public String pingUser()
Callers of this method must have the "user" role.- Specified by:
pingUserin interfaceSecurePing
-
pingAdmin
@RolesAllowed("admin") public String pingAdmin()
Callers of this method must have the "admin" role.- Specified by:
pingAdminin interfaceSecurePing
-
pingExcluded
@DenyAll public String pingExcluded()
No one should be allowed to call this method.- Specified by:
pingExcludedin interfaceSecurePing
-
isCallerInRole
@PermitAll public boolean isCallerInRole(String role)
This method allows the RMI Test to check whether the current subject has a specific role. This type of method would normally be used within an EJB to perform object-level access control.- Specified by:
isCallerInRolein interfaceSecurePing
-
whoAmI
@PermitAll public String whoAmI()
- Specified by:
whoAmIin interfaceSecurePing
-
-