diff --git a/autoconfigure/pom.xml b/autoconfigure/pom.xml index 7bdf470d..79e4725e 100644 --- a/autoconfigure/pom.xml +++ b/autoconfigure/pom.xml @@ -10,7 +10,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Spring Boot Autoconfigure module diff --git a/pom.xml b/pom.xml index c4f8a792..21ba29f0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent pom - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Parent POM Parent POM for Spring SAML Identity Provider libraries diff --git a/saml-identity-provider/pom.xml b/saml-identity-provider/pom.xml index b5275d75..be15c980 100644 --- a/saml-identity-provider/pom.xml +++ b/saml-identity-provider/pom.xml @@ -9,7 +9,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Core Library diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/Saml2AuditEvent.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/Saml2AuditEvent.java index aa2d416d..13021dea 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/Saml2AuditEvent.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/Saml2AuditEvent.java @@ -32,7 +32,7 @@ /** * Audit event for creating event objects for the SAML IdP. - * + * * @author Martin Lindström */ @JsonInclude(Include.NON_EMPTY) @@ -48,7 +48,7 @@ public class Saml2AuditEvent extends AuditEvent { /** * Constructor. - * + * * @param type the type of audit event * @param timestamp the timestamp (in millis since epoch) * @param spEntityId the entityID of the requesting SP @@ -57,13 +57,13 @@ public class Saml2AuditEvent extends AuditEvent { */ public Saml2AuditEvent(final String type, final long timestamp, final String spEntityId, final String authnRequestId, final Saml2AuditData... data) { - super(Instant.ofEpochMilli(timestamp), type, Optional.ofNullable(spEntityId).orElseGet(() -> UNKNOWN_SP), + super(Instant.ofEpochMilli(timestamp), Optional.ofNullable(spEntityId).orElseGet(() -> UNKNOWN_SP), type, buildData(spEntityId, authnRequestId, data)); } /** * Builds a {@link Map} given the supplied audit data - * + * * @param spEntityId the entityID of the requesting SP * @param authnRequestId the ID of the {@code AuthnRequest} * @param data audit data @@ -87,7 +87,7 @@ private static Map buildData( /** * Gets a string suitable to include in log entries. It does not dump the entire audit data that can contain sensible * data (that should not be present in proceess logs). - * + * * @return a log string */ @JsonIgnore diff --git a/saml-identity-provider/src/test/java/se/swedenconnect/spring/saml/idp/it/AuthenticationIntegrationTest.java b/saml-identity-provider/src/test/java/se/swedenconnect/spring/saml/idp/it/AuthenticationIntegrationTest.java index 90ed1152..6e9398ac 100644 --- a/saml-identity-provider/src/test/java/se/swedenconnect/spring/saml/idp/it/AuthenticationIntegrationTest.java +++ b/saml-identity-provider/src/test/java/se/swedenconnect/spring/saml/idp/it/AuthenticationIntegrationTest.java @@ -75,6 +75,7 @@ import se.swedenconnect.spring.saml.idp.OpenSamlTestBase; import se.swedenconnect.spring.saml.idp.attributes.UserAttribute; import se.swedenconnect.spring.saml.idp.audit.Saml2AuditEvent; +import se.swedenconnect.spring.saml.idp.audit.Saml2AuditEvents; import se.swedenconnect.spring.saml.idp.authentication.Saml2UserAuthentication; import se.swedenconnect.spring.saml.idp.authentication.Saml2UserAuthenticationInputToken; import se.swedenconnect.spring.saml.idp.authentication.Saml2UserDetails; @@ -109,7 +110,7 @@ public class AuthenticationIntegrationTest extends OpenSamlTestBase { @Autowired private Saml2EventListener eventListener; - + @Autowired private AuditEventListener auditListener; @@ -176,7 +177,11 @@ public String getPreferredBinding() { Assertions.assertTrue(this.eventListener.getEvents().get(3) instanceof Saml2SuccessResponseEvent); // Auditing - Assertions.assertEquals(4, this.auditListener.getEvents().size()); + Assertions.assertEquals(4, this.auditListener.getEvents().size()); + Assertions.assertEquals(Saml2AuditEvents.SAML2_AUDIT_REQUEST_RECEIVED, this.auditListener.getEvents().get(0).getType()); + Assertions.assertEquals(Saml2AuditEvents.SAML2_AUDIT_BEFORE_USER_AUTHN, this.auditListener.getEvents().get(1).getType()); + Assertions.assertEquals(Saml2AuditEvents.SAML2_AUDIT_AFTER_USER_AUTHN, this.auditListener.getEvents().get(2).getType()); + Assertions.assertEquals(Saml2AuditEvents.SAML2_AUDIT_SUCCESSFUL_RESPONSE, this.auditListener.getEvents().get(3).getType()); } @Test @@ -266,9 +271,9 @@ public AuthnRequestCustomizer getAuthnRequestCustomizer() { Assertions.assertTrue(this.eventListener.getEvents().get(1) instanceof Saml2PreUserAuthenticationEvent); Assertions.assertTrue(this.eventListener.getEvents().get(2) instanceof Saml2PostUserAuthenticationEvent); Assertions.assertTrue(this.eventListener.getEvents().get(3) instanceof Saml2SuccessResponseEvent); - + // Auditing - Assertions.assertEquals(4, this.auditListener.getEvents().size()); + Assertions.assertEquals(4, this.auditListener.getEvents().size()); } @Test @@ -354,9 +359,9 @@ public String getPreferredBinding() { Assertions.assertTrue(Saml2PostUserAuthenticationEvent.class.cast(this.eventListener.getEvents().get(6)) .getUserAuthentication().isSsoApplied()); Assertions.assertTrue(this.eventListener.getEvents().get(7) instanceof Saml2SuccessResponseEvent); - + // Auditing - Assertions.assertEquals(8, this.auditListener.getEvents().size()); + Assertions.assertEquals(8, this.auditListener.getEvents().size()); } private EntityDescriptor getIdpMetadata() throws Exception { @@ -452,7 +457,7 @@ public static class ApplicationConfiguration { Saml2EventListener saml2EventListener() { return new Saml2EventListener(); } - + @Bean AuditEventListener auditListener() { return new AuditEventListener(); @@ -521,11 +526,11 @@ public static class AuditEventListener implements ApplicationListener se.swedenconnect.spring.saml.idp spring-saml-idp-samples-parent - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Samples :: Client Application diff --git a/samples/demo-boot-idp/pom.xml b/samples/demo-boot-idp/pom.xml index 7b986878..6178ef2b 100644 --- a/samples/demo-boot-idp/pom.xml +++ b/samples/demo-boot-idp/pom.xml @@ -9,7 +9,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-samples-parent - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Samples :: Spring Boot Starter Demo Application diff --git a/samples/pom.xml b/samples/pom.xml index c7e2f8c7..43d759d1 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -9,7 +9,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Samples :: Parent POM diff --git a/starter/pom.xml b/starter/pom.xml index f73380b8..09df4fda 100644 --- a/starter/pom.xml +++ b/starter/pom.xml @@ -10,7 +10,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 1.1.1 + 1.1.2-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Spring Boot Starter