@Test
void testAccessConfirmationPage(
@Autowired JdbcScimUserProvisioning jdbcScimUserProvisioning
) throws Exception {
ScimUser marissa = jdbcScimUserProvisioning.query("username eq \"marissa\" and origin eq \"uaa\"", IdentityZoneHolder.get().getId()).get(0);
UaaPrincipal uaaPrincipal = new UaaPrincipal(marissa.getId(), marissa.getUserName(), marissa.getPrimaryEmail(), marissa.getOrigin(), marissa.getExternalId(), IdentityZoneHolder.get().getId());
UaaAuthentication principal = new UaaAuthentication(uaaPrincipal, singletonList(UaaAuthority.fromAuthorities("uaa.user")), null);
MockHttpSession session = new MockHttpSession();
SecurityContext securityContext = new SecurityContextImpl();
securityContext.setAuthentication(principal);
session.putValue("SPRING_SECURITY_CONTEXT", securityContext);
MockHttpServletRequestBuilder get = get("/oauth/authorize")
.accept(TEXT_HTML)
.param("response_type", "code")
.param("client_id", "app")
.param("state", "somestate")
.param("redirect_uri", "http://localhost:8080/app/")
.session(session)
.principal(principal);
mockMvc.perform(get)
.andExpect(status().isOk())
.andExpect(forwardedUrl("/oauth/confirm_access"));
}