...
Code Block |
---|
| java |
---|
| java |
---|
title | Example for an AccessDecisionVoter with a custom MessageContext |
---|
|
@ApplicationScoped
public class OrderVoter extends AbstractAccessDecisionVoter
{
@Inject
private UserService userService;
@Inject
private User currentUser;
@Inject
@Custom
private MessageContext messageContext;
public void checkPermission(InvocationContext invocationContext, Set<SecurityViolation> violations)
{
if(!this.loginService.isActiveUser(this.currentUser))
{
String reason = this.messageContext.message().text("{inactive_user_violation}").toText();
violations.add(newSecurityViolation(reason));
}
}
}
|
(Security) Error pages
The following example shows how to create a default error page. It's just allowed to provide one default error page per application.
Instead of implementing ViewConfig
it's required to implement the DefaultErrorView
interface.
...