use of com.iplanet.sso.SSOTokenID in project OpenAM by OpenRock.
the class SessionResourceTest method shouldUsePAPLogoutRedirectUrlWhenSet.
@Test
public void shouldUsePAPLogoutRedirectUrlWhenSet() throws Exception {
// Given
final String sessionId = "SSO_TOKEN_ID";
final String logoutUrl = "http://forgerock.com/about";
final ActionRequest request = mock(ActionRequest.class);
final HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
final AttributesContext context = new AttributesContext(new AdviceContext(realmContext, Collections.<String>emptyList()));
final SSOTokenID tokenId = mock(SSOTokenID.class);
context.getAttributes().put(HttpServletRequest.class.getName(), httpServletRequest);
given(request.getAction()).willReturn(LOGOUT_ACTION_ID);
given(ssoTokenManager.createSSOToken(sessionId)).willReturn(ssoToken);
given(ssoToken.getTokenID()).willReturn(tokenId);
given(tokenId.toString()).willReturn(sessionId);
given(authUtilsWrapper.logout(eq(sessionId), eq(httpServletRequest), any(HttpServletResponse.class))).willReturn(true);
given(authUtilsWrapper.getPostProcessLogoutURL(httpServletRequest)).willReturn(logoutUrl);
// When
ActionResponse response = sessionResource.actionInstance(context, sessionId, request).getOrThrowUninterruptibly();
// Then
assertThat(response).isNotNull().withContent().stringAt("goto").isEqualTo(logoutUrl);
}
Aggregations