### Question:
UnknownMethodAlgorithmLogger { public static void probeAuthnRequestForMethodAlgorithm(final AuthnRequestFromRelyingParty authnRequest) { if (authnRequest != null) { authnRequest.getSignature().ifPresent((signature) -> logMethodAlgorithm(Role.SP, signature, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME) ); } }  static void probeResponseForMethodAlgorithm(final InboundResponseFromIdp response); static void probeAssertionForMethodAlgorithm(final Assertion assertion, final String typeOfAssertion); static void probeAuthnRequestForMethodAlgorithm(final AuthnRequestFromRelyingParty authnRequest); static final String SIGNATURE_AND_DIGEST_ALGORITHMS_MESSAGE; static final String SIGNATURE_ALGORITHM_MESSAGE; static final String DIGEST_ALGORITHM_MESSAGE; }### Answer:
@Test public void shouldNotReportStrongAlgorithmsInSPAuthnRequest() throws Exception { AuthnRequestFromRelyingParty authnRequestFromRelyingParty = anAuthnRequestFromRelyingParty() .withId(ID) .withIssuer(ISSUER_SP) .withSignature(signature.get()) .build(); UnknownMethodAlgorithmLogger.probeAuthnRequestForMethodAlgorithm(authnRequestFromRelyingParty); verify(mockAppender, times(0)).doAppend(captorLoggingEvent.capture()); }
@Test public void shouldReportUnknownSignatureAlgorithmInSPAuthnRequest() throws Exception { AuthnRequestFromRelyingParty authnRequestFromRelyingParty = anAuthnRequestFromRelyingParty() .withId(ID) .withIssuer(ISSUER_SP) .withSignature(signatureWithUnknownSignatureAlgorithm.get()) .build(); UnknownMethodAlgorithmLogger.probeAuthnRequestForMethodAlgorithm(authnRequestFromRelyingParty); verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.SIGNATURE_ALGORITHM_MESSAGE, SP, SIGNATURE_RSA_SHA1_ID, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME)); }
@Test public void shouldReportUnknownDigestAlgorithmInSPAuthnRequest() throws Exception { AuthnRequestFromRelyingParty authnRequestFromRelyingParty = anAuthnRequestFromRelyingParty() .withId(ID) .withIssuer(ISSUER_SP) .withSignature(signatureWithUnknownDigestAlgorithm.get()) .build(); UnknownMethodAlgorithmLogger.probeAuthnRequestForMethodAlgorithm(authnRequestFromRelyingParty); verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.DIGEST_ALGORITHM_MESSAGE, SP, DIGEST_SHA1_ID, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME)); }
@Test public void shouldReportUnknownSignatureAndDigestAlgorithmsInSPAuthnRequest() throws Exception { AuthnRequestFromRelyingParty authnRequestFromRelyingParty = anAuthnRequestFromRelyingParty() .withId(ID) .withIssuer(ISSUER_SP) .withSignature(signatureWithUnknownSignatureAndDigestAlgorithms.get()) .build(); UnknownMethodAlgorithmLogger.probeAuthnRequestForMethodAlgorithm(authnRequestFromRelyingParty); verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.SIGNATURE_AND_DIGEST_ALGORITHMS_MESSAGE, SP, SIGNATURE_RSA_SHA1_ID, DIGEST_SHA1_ID, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME)); }