@Test
    void verifyUnAuthz() {
        val request = new MockHttpServletRequest();
        val requestBody = new LinkedMultiValueMap<String, String>();
        request.addHeader(SurrogateAuthenticationRestHttpRequestCredentialFactory.REQUEST_HEADER_SURROGATE_PRINCIPAL, "surrogate");
        requestBody.add("username", "test");
        requestBody.add("password", "password");

        val service = getSurrogateAuthenticationService(Map.of("test", List.of("other-user")));
        val factory = new SurrogateAuthenticationRestHttpRequestCredentialFactory(service, casProperties.getAuthn().getSurrogate());
        assertThrows(SurrogateAuthenticationException.class, () -> factory.fromRequest(request, requestBody));
    }
This is {@link SurrogateAuthenticationRestHttpRequestCredentialFactoryTests}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-surrogate-authentication/src/test/java/org/apereo/cas/authentication/rest/SurrogateAuthenticationRestHttpRequestCredentialFactoryTests.java