use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class IdpAssertionMetricsCollectorTest method shouldNotRegisterIdpAlreadyExist.
@Test
public void shouldNotRegisterIdpAlreadyExist() {
MetricRegistry metricRegistry = mock(MetricRegistry.class);
SortedMap<String, Gauge> gaugeMock = mock(SortedMap.class);
when(gaugeMock.containsKey(any())).thenReturn(true);
when(metricRegistry.getGauges()).thenReturn(gaugeMock);
Assertion assertion = anAssertion().withIssuer(anIssuer().withIssuerId("testIdP").build()).buildUnencrypted();
IdpAssertionMetricsCollector idpAssertionMetricsCollector = new IdpAssertionMetricsCollector(metricRegistry);
idpAssertionMetricsCollector.update(assertion);
verify(metricRegistry, times(0)).register(any(), any());
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class NotOnOrAfterLoggerTest method shouldLogNotOnOrAfterWithIdp.
@Test
public void shouldLogNotOnOrAfterWithIdp() {
DateTime notOnOrAfter = DateTime.now().withZone(DateTimeZone.UTC).plusHours(1);
Assertion assertion = anAssertionWithNotOnOrAfter(notOnOrAfter);
String typeOfAssertion = "assertionType";
NotOnOrAfterLogger.logAssertionNotOnOrAfter(assertion, typeOfAssertion);
String expectedMessage = String.format("NotOnOrAfter in %s from %s is set to %s", typeOfAssertion, ISSUER_IDP, notOnOrAfter.toString(dateTimeFormatter));
verifyLog(mockAppender, captorLoggingEvent, expectedMessage);
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class UnknownMethodAlgorithmLoggerTest method shouldNotReportStrongAlgorithmsInIDPAssertion.
@Test
public void shouldNotReportStrongAlgorithmsInIDPAssertion() throws Exception {
Assertion authnStatementAssertion = anAssertion().withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()).buildUnencrypted();
UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT);
verify(mockAppender, times(0)).doAppend(captorLoggingEvent.capture());
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class UnknownMethodAlgorithmLoggerTest method shouldReportUnknownSignatureAlgorithmInIDPAssertion.
@Test
public void shouldReportUnknownSignatureAlgorithmInIDPAssertion() throws Exception {
Assertion authnStatementAssertion = anAssertion().withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()).withSignature(signatureWithUnknownSignatureAlgorithm.get()).buildUnencrypted();
UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT);
verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.SIGNATURE_ALGORITHM_MESSAGE, IDP, SIGNATURE_RSASHA1_ID, AUTHN_STATEMENT + Assertion.DEFAULT_ELEMENT_LOCAL_NAME));
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class UnknownMethodAlgorithmLoggerTest method shouldReportUnknownSignatureAndDigestAlgorithmsInIDPAssertion.
@Test
public void shouldReportUnknownSignatureAndDigestAlgorithmsInIDPAssertion() throws Exception {
Assertion authnStatementAssertion = anAssertion().withId(ID).withIssuer(anIssuer().withIssuerId(ISSUER_IDP).build()).withSignature(signatureWithUnknownSignatureAndDigestAlgorithms.get()).buildUnencrypted();
UnknownMethodAlgorithmLogger.probeAssertionForMethodAlgorithm(authnStatementAssertion, AUTHN_STATEMENT);
verifyLog(mockAppender, captorLoggingEvent, 1, String.format(UnknownMethodAlgorithmLogger.SIGNATURE_AND_DIGEST_ALGORITHMS_MESSAGE, IDP, SIGNATURE_RSASHA1_ID, DIGEST_SHA1_ID, AUTHN_STATEMENT + Assertion.DEFAULT_ELEMENT_LOCAL_NAME));
}
Aggregations