Search in sources :

Example 1 with AuthyTokenCredential

use of org.apereo.cas.adaptors.authy.AuthyTokenCredential in project cas by apereo.

the class AuthyAuthenticationWebflowEventResolverTests method beforeAll.

@BeforeEach
public void beforeAll() {
    val request = new MockHttpServletRequest();
    val response = new MockHttpServletResponse();
    when(context.getMessageContext()).thenReturn(mock(MessageContext.class));
    when(context.getConversationScope()).thenReturn(new LocalAttributeMap<>());
    when(context.getFlowScope()).thenReturn(new LocalAttributeMap<>());
    when(context.getRequestParameters()).thenReturn(new MockParameterMap());
    when(context.getRequestScope()).thenReturn(new LocalAttributeMap<>());
    when(context.getFlashScope()).thenReturn(new LocalAttributeMap<>());
    when(context.getExternalContext()).thenReturn(new ServletExternalContext(new MockServletContext(), request, response));
    RequestContextHolder.setRequestContext(context);
    ExternalContextHolder.setExternalContext(context.getExternalContext());
    WebUtils.putCredential(context, new AuthyTokenCredential("token"));
}
Also used : lombok.val(lombok.val) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ServletExternalContext(org.springframework.webflow.context.servlet.ServletExternalContext) MockParameterMap(org.springframework.webflow.test.MockParameterMap) MessageContext(org.springframework.binding.message.MessageContext) AuthyTokenCredential(org.apereo.cas.adaptors.authy.AuthyTokenCredential) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) MockServletContext(org.springframework.mock.web.MockServletContext) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

lombok.val (lombok.val)1 AuthyTokenCredential (org.apereo.cas.adaptors.authy.AuthyTokenCredential)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 MessageContext (org.springframework.binding.message.MessageContext)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)1 MockParameterMap (org.springframework.webflow.test.MockParameterMap)1