@Test void testWrongSignatureCertificate() throws URISyntaxException { RequestingServiceProvider sp = new RequestingServiceProvider("http: URL resource = RequestHandlerTest.class.getResource("/de/governikus/eumw/eidasmiddleware/bos-test-tctoken.saml-encr.p12"); File keystoreFile = new File(resource.toURI()); KeyStore signatureKeystore = KeyStoreSupporter.readKeyStore(keystoreFile, DEFAULT_PASSWORD); sp.setSignatureCert((X509Certificate)KeyStoreSupporter.getCertificate(signatureKeystore, "bos-test-tctoken.saml-encr") .get()); Mockito.when(mockServiceProviderConfig.getProviderByEntityID("http: .thenReturn(sp); RequestHandler requestHandler = new RequestHandler(mockSessionStore, mockConfigHolder, mockServiceProviderConfig); RequestProcessingException requestProcessingException = Assertions.assertThrows(RequestProcessingException.class, () -> requestHandler.handleSAMLRequest(RELAY_STATE, GET_REQUEST, false)); Assertions.assertEquals(requestProcessingException.getCause().getClass(), ErrorCodeException.class, "ErrorCodeException expected as cause"); Assertions.assertEquals(RequestHandler.CANNOT_PARSE_SAML_REQUEST, requestProcessingException.getMessage()); }
String handleSAMLRequest(String samlRequestBase64, boolean isPost) { return handleSAMLRequest(null, samlRequestBase64, isPost); }
RequestHandler { String handleSAMLRequest(String samlRequestBase64, boolean isPost) { return handleSAMLRequest(null, samlRequestBase64, isPost); } }
RequestHandler { String handleSAMLRequest(String samlRequestBase64, boolean isPost) { return handleSAMLRequest(null, samlRequestBase64, isPost); } RequestHandler(SessionStore store,
                        ConfigHolder configHolder,
                        ServiceProviderConfig serviceProviderConfig); }
RequestHandler { String handleSAMLRequest(String samlRequestBase64, boolean isPost) { return handleSAMLRequest(null, samlRequestBase64, isPost); } RequestHandler(SessionStore store,
                        ConfigHolder configHolder,
                        ServiceProviderConfig serviceProviderConfig); String handleSAMLRequest(String relayState, String samlRequestBase64, boolean isPost); String getTcTokenURL(String sessionId); }
RequestHandler { String handleSAMLRequest(String samlRequestBase64, boolean isPost) { return handleSAMLRequest(null, samlRequestBase64, isPost); } RequestHandler(SessionStore store,
                        ConfigHolder configHolder,
                        ServiceProviderConfig serviceProviderConfig); String handleSAMLRequest(String relayState, String samlRequestBase64, boolean isPost); String getTcTokenURL(String sessionId); static final String CANNOT_PARSE_SAML_REQUEST; }