assert request.getRemoteUser() != null && request.getRemoteUser().equals(JAAS_USER);
assert request.isUserInRole(JAAS_ROLE);
}
public HttpServletRequest initializeWrappedRequest() {
HttpSession session = new MockHttpSession();
Identity identity = new Identity() {
@Override
public Principal getPrincipal()
{
return new SimplePrincipal(SEAM_USER);
}
@Override
public boolean hasRole(String role)
{
return SEAM_ROLE.equals(role);
}
};
session.setAttribute(Seam.getComponentName(Identity.class), identity);
HttpServletRequest request = new MockHttpServletRequest(session, JAAS_USER, new HashSet<String>(Arrays.asList(JAAS_ROLE)), null, "GET");
return new IdentityRequestWrapper(request);
}