1 package net.sourceforge.sannotations.security;
2
3 import net.sourceforge.sannotations.security.RoleValidator;
4 import net.sourceforge.sannotations.utils.RequestHolder;
5
6 /***
7 * {@link net.sourceforge.sannotations.security.RoleValidator} instance that asks the current {@link javax.servlet.http.HttpServletRequest} instance if the user has the needed role
8 * @author urubatan
9 *
10 */
11 public class ServletRequestValidator implements RoleValidator
12 {
13
14 public boolean isUserInRole(String role)
15 {
16 try {
17 return RequestHolder.getRequest().isUserInRole(role);
18 } catch (Throwable t) {
19 return false;
20 }
21 }
22
23 }