// Add session id and endpoint cookies to the request
Cookie sidCookie = new Cookie(SecurityContextUtil.FORCE_FORCE_SESSION, SESSION_ID);
Cookie endpointCookie = new Cookie(SecurityContextUtil.FORCE_FORCE_ENDPOINT, ENDPOINT);
request.setCookies(sidCookie, endpointCookie);
AuthFilter filter = new AuthFilter();
MockFilterConfig filterConfig = new MockFilterConfig();
// Add good OAuth info
filterConfig.addInitParameter("customDataRetriever", TestUserDataRetriever.class.getName());
filterConfig.addInitParameter("endpoint", ENDPOINT);
filterConfig.addInitParameter("oauthKey", "key");
filterConfig.addInitParameter("oauthSecret", "secret");
filterConfig.addInitParameter("securityContextStorageMethod", "session");
filter.init(filterConfig);
VerificationFilterChain filterChain = new VerificationFilterChain();
mockDataRetriever.assertRefreshToken = false;
try {
filter.doFilter(request, response, filterChain);
} finally {
mockDataRetriever.assertRefreshToken = true;
}
HttpSession session = request.getSession();