protected Guard createSecurityGuard() { ApplicationContext context = getApplicationContext(); AccessDecisionManager accessDecisionManager = context.getBean(AccessDecisionManager.class); WebInvocationPrivilegeEvaluator invocationPrivilegeEvaluator = context .getBean(WebInvocationPrivilegeEvaluator.class); if (accessDecisionManager == null || invocationPrivilegeEvaluator == null) { return null; } SpringSecurityGuard springSecurityGuard = new SpringSecurityGuard(); springSecurityGuard.setApplicationContext(context); springSecurityGuard.setAccessDecisionManager(accessDecisionManager); springSecurityGuard.setInvocationPrivilegeEvaluator(invocationPrivilegeEvaluator); try { springSecurityGuard.afterPropertiesSet(); } catch (Exception e) { throw new RuntimeException("Error initialization security Guard", e); } return springSecurityGuard; }
@Autowired public WelcomeController(WebInvocationPrivilegeEvaluator webPrivEvaluator) { this.webInvocationPriviledgeEvaluator = webPrivEvaluator; }
public WebInvocationPrivilegeEvaluator getInvocationPrivilegeEvaluator() { return invocationPrivilegeEvaluator; }
public void setInvocationPrivilegeEvaluator(WebInvocationPrivilegeEvaluator invocationPrivilegeEvaluator) { this.invocationPrivilegeEvaluator = invocationPrivilegeEvaluator; }