Search in sources :

Example 1 with ClientIpDeviceFingerprintComponentManager

use of org.apereo.cas.trusted.web.flow.fingerprint.ClientIpDeviceFingerprintComponentManager in project cas by apereo.

the class ClientIpDeviceFingerprintComponentManagerTests method verifyClientIpFingerprintNotFound.

@Test
public void verifyClientIpFingerprintNotFound() {
    val request = new MockHttpServletRequest();
    val response = new MockHttpServletResponse();
    ClientInfoHolder.setClientInfo(null);
    val ex = new ClientIpDeviceFingerprintComponentManager();
    assertFalse(ex.extractComponent("casuser", request, response).isPresent());
}
Also used : lombok.val(lombok.val) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ClientIpDeviceFingerprintComponentManager(org.apereo.cas.trusted.web.flow.fingerprint.ClientIpDeviceFingerprintComponentManager) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.jupiter.api.Test)

Example 2 with ClientIpDeviceFingerprintComponentManager

use of org.apereo.cas.trusted.web.flow.fingerprint.ClientIpDeviceFingerprintComponentManager in project cas by apereo.

the class ClientIpDeviceFingerprintComponentManagerTests method verifyClientIpFingerprintFound.

@Test
public void verifyClientIpFingerprintFound() {
    val request = new MockHttpServletRequest();
    val response = new MockHttpServletResponse();
    request.setRemoteAddr("1.2.3.4");
    val clientInfo = new ClientInfo(request);
    ClientInfoHolder.setClientInfo(clientInfo);
    val ex = new ClientIpDeviceFingerprintComponentManager();
    assertTrue(ex.extractComponent("casuser", request, response).isPresent());
}
Also used : lombok.val(lombok.val) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ClientInfo(org.apereo.inspektr.common.web.ClientInfo) ClientIpDeviceFingerprintComponentManager(org.apereo.cas.trusted.web.flow.fingerprint.ClientIpDeviceFingerprintComponentManager) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)2 ClientIpDeviceFingerprintComponentManager (org.apereo.cas.trusted.web.flow.fingerprint.ClientIpDeviceFingerprintComponentManager)2 Test (org.junit.jupiter.api.Test)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 ClientInfo (org.apereo.inspektr.common.web.ClientInfo)1