From d9e08658c70260e3b4a49b0c6b9eceaa0726f11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Lindstr=C3=B6m?= Date: Mon, 9 Dec 2024 14:46:44 +0100 Subject: [PATCH] IS-91 Made sure multiple log entries were not produced from the same base class (#92) --- autoconfigure/pom.xml | 4 +-- docs/release-notes.md | 31 +++++++++++++++---- pom.xml | 2 +- saml-identity-provider/pom.xml | 2 +- .../idp/Saml2IdentityProviderVersion.java | 2 +- .../FileBasedAuditEventRepository.java | 10 +++--- .../FilteringAuditEventRepository.java | 3 +- .../MemoryBasedAuditEventRepository.java | 3 ++ .../RedisListAuditEventRepository.java | 1 + ...edissonTimeSeriesAuditEventRepository.java | 1 + samples/client/pom.xml | 2 +- samples/demo-boot-idp/pom.xml | 2 +- samples/pom.xml | 2 +- starter/pom.xml | 2 +- 14 files changed, 45 insertions(+), 22 deletions(-) diff --git a/autoconfigure/pom.xml b/autoconfigure/pom.xml index d7617c36..030414e2 100644 --- a/autoconfigure/pom.xml +++ b/autoconfigure/pom.xml @@ -10,7 +10,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 2.3.0 + 2.3.1-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Spring Boot Autoconfigure module @@ -106,7 +106,7 @@ org.redisson redisson-spring-boot-starter - 3.39.0 + 3.40.1 true diff --git a/docs/release-notes.md b/docs/release-notes.md index b463bb3a..0a7ec6da 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,11 +4,21 @@ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/se.swedenconnect.spring.saml.idp/spring-saml-idp/badge.svg)](https://maven-badges.herokuapp.com/maven-central/se.swedenconnect.spring.saml.idp/spring-saml-idp) +### Version 2.3.1 + +Date: + +- When using more than one audit logger, multiple log entries were produced from the same base class. This has been + fixed. + ### Version 2.3.0 Date: 2024-12-08 -- The latest version of the [credentials-support](https://docs.swedenconnect.se/credentials-support/) is now used by the library. Using this library, the [Credentials Bundles](https://docs.swedenconnect.se/credentials-support/#the-bundles-concept) concept can by used for a better was of configuring credentials. +- The latest version of the [credentials-support](https://docs.swedenconnect.se/credentials-support/) is now used by the + library. Using this library, + the [Credentials Bundles](https://docs.swedenconnect.se/credentials-support/#the-bundles-concept) concept can by used + for a better was of configuring credentials. - New audit entries for credential monitoring are published, if credential monitoring is being used. @@ -16,18 +26,27 @@ Date: 2024-12-08 Date: 2024-11-21 -- Support for the eIDAS (optional) attributes Nationality, CountryOfResidence, CountryOfBirth and TownOfBirth was added to attribute conversion logic. This fix only applies to IdP:s that proxy assertions from eIDAS. +- Support for the eIDAS (optional) attributes Nationality, CountryOfResidence, CountryOfBirth and TownOfBirth was added + to attribute conversion logic. This fix only applies to IdP:s that proxy assertions from eIDAS. -- When configuring an HTTPS Metadata Provider it is now possible to configure it with a `https-trust-bundle` to specify which root certificates that are accepted during TLS server certificate validation. See [Metadata Provider Configuration](https://docs.swedenconnect.se/saml-identity-provider/configuration.html#metadata-provider-configuration). +- When configuring an HTTPS Metadata Provider it is now possible to configure it with a `https-trust-bundle` to specify + which root certificates that are accepted during TLS server certificate validation. + See [Metadata Provider Configuration](https://docs.swedenconnect.se/saml-identity-provider/configuration.html#metadata-provider-configuration). ### Version 2.2.0 Date: 2024-10-04 -- The [Saml2ServiceProviderFilter](https://github.com/swedenconnect/saml-identity-provider/blob/main/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/authnrequest/Saml2ServiceProviderFilter.java) interface was introduced. By declaring a bean of this type, an implementation may add additional restrictions on which Service Provider that are allowed to send requests. +- + +The [Saml2ServiceProviderFilter](https://github.com/swedenconnect/saml-identity-provider/blob/main/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/authnrequest/Saml2ServiceProviderFilter.java) +interface was introduced. By declaring a bean of this type, an implementation may add additional restrictions on which +Service Provider that are allowed to send requests. -- (embarrassing) We started publishing release notes ... +- (embarrassing) We started publishing release notes ... ---- -Copyright © 2022-2024, [Myndigheten för digital förvaltning - Swedish Agency for Digital Government (DIGG)](http://www.digg.se). Licensed under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0). +Copyright © +2022-2024, [Myndigheten för digital förvaltning - Swedish Agency for Digital Government (DIGG)](http://www.digg.se). +Licensed under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0). diff --git a/pom.xml b/pom.xml index 6fbb261b..0193305c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent pom - 2.3.0 + 2.3.1-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 a92e6755..347ce20b 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 - 2.3.0 + 2.3.1-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Core Library diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/Saml2IdentityProviderVersion.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/Saml2IdentityProviderVersion.java index a0dd8752..f0a0aae9 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/Saml2IdentityProviderVersion.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/Saml2IdentityProviderVersion.java @@ -24,7 +24,7 @@ public final class Saml2IdentityProviderVersion { private static final int MAJOR = 2; private static final int MINOR = 3; - private static final int PATCH = 0; + private static final int PATCH = 1; /** * Global serialization value for SAML Identity Provider classes. diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FileBasedAuditEventRepository.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FileBasedAuditEventRepository.java index e4250eac..79184716 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FileBasedAuditEventRepository.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FileBasedAuditEventRepository.java @@ -15,6 +15,10 @@ */ package se.swedenconnect.spring.saml.idp.audit.repository; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.actuate.audit.AuditEvent; +import org.springframework.boot.actuate.audit.AuditEventRepository; + import java.io.IOException; import java.nio.file.Path; import java.time.Instant; @@ -25,11 +29,6 @@ import java.util.logging.Level; import java.util.logging.Logger; -import org.springframework.boot.actuate.audit.AuditEvent; -import org.springframework.boot.actuate.audit.AuditEventRepository; - -import lombok.extern.slf4j.Slf4j; - /** * A write-only {@link AuditEventRepository} that writes audit events to a file. * @@ -85,6 +84,7 @@ public FileBasedAuditEventRepository( @Override public void addEvent(final AuditEvent event) { try { + log.debug("Audit logging event '{}' for principal '{}' ...", event.getType(), event.getPrincipal()); this.auditLogger.log(Level.INFO, this.eventMapper.write(event)); } catch (final Throwable e) { diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FilteringAuditEventRepository.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FilteringAuditEventRepository.java index d8dc1542..6fbfe3bb 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FilteringAuditEventRepository.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/FilteringAuditEventRepository.java @@ -57,11 +57,10 @@ public FilteringAuditEventRepository(final Predicate filter) { public final void add(final AuditEvent event) { if (event != null) { if (this.filter.test(event)) { - log.debug("Audit logging event '{}' for principal '{}' ...", event.getType(), event.getPrincipal()); this.addEvent(event); } else { - log.debug("Audit event {} not logged - filter rules excludes it", event.getType()); + log.trace("Audit event {} not logged - filter rules excludes it", event.getType()); } } } diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/MemoryBasedAuditEventRepository.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/MemoryBasedAuditEventRepository.java index 0786e56f..4155e317 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/MemoryBasedAuditEventRepository.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/MemoryBasedAuditEventRepository.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.function.Predicate; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.actuate.audit.AuditEvent; import org.springframework.boot.actuate.audit.AuditEventRepository; import org.springframework.boot.actuate.audit.InMemoryAuditEventRepository; @@ -30,6 +31,7 @@ * * @author Martin Lindström */ +@Slf4j public class MemoryBasedAuditEventRepository extends FilteringAuditEventRepository { public static final int DEFAULT_CAPACITY = 1000; @@ -70,6 +72,7 @@ public MemoryBasedAuditEventRepository(final Predicate filter, final /** {@inheritDoc} */ @Override protected void addEvent(final AuditEvent event) { + log.debug("Audit logging event '{}' for principal '{}' ...", event.getType(), event.getPrincipal()); this.repository.add(event); } diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedisListAuditEventRepository.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedisListAuditEventRepository.java index 913744a7..66a5ba68 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedisListAuditEventRepository.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedisListAuditEventRepository.java @@ -79,6 +79,7 @@ public RedisListAuditEventRepository(final StringRedisTemplate redisTemplate, fi @Override protected void addEvent(final AuditEvent event) { try { + log.debug("Audit logging event '{}' for principal '{}' ...", event.getType(), event.getPrincipal()); this.listOps.rightPush(this.keyName, this.eventMapper.write(event)); } catch (final Throwable e) { diff --git a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedissonTimeSeriesAuditEventRepository.java b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedissonTimeSeriesAuditEventRepository.java index 29bd73d2..091e6f94 100644 --- a/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedissonTimeSeriesAuditEventRepository.java +++ b/saml-identity-provider/src/main/java/se/swedenconnect/spring/saml/idp/audit/repository/RedissonTimeSeriesAuditEventRepository.java @@ -80,6 +80,7 @@ public RedissonTimeSeriesAuditEventRepository(final RedissonClient client, final @Override protected void addEvent(final AuditEvent event) { try { + log.debug("Audit logging event '{}' for principal '{}' ...", event.getType(), event.getPrincipal()); this.client.getTimeSeries(this.tsName) .add(event.getTimestamp().toEpochMilli(), this.eventMapper.write(event)); } diff --git a/samples/client/pom.xml b/samples/client/pom.xml index cb10587f..33ae3f6c 100644 --- a/samples/client/pom.xml +++ b/samples/client/pom.xml @@ -9,7 +9,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-samples-parent - 2.3.0 + 2.3.1-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 685fe080..ddc28bd8 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 - 2.3.0 + 2.3.1-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Samples :: Spring Boot Starter Demo Application diff --git a/samples/pom.xml b/samples/pom.xml index 85a4cbe7..3f813fef 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -9,7 +9,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 2.3.0 + 2.3.1-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Samples :: Parent POM diff --git a/starter/pom.xml b/starter/pom.xml index 6c121eb6..c9fac4db 100644 --- a/starter/pom.xml +++ b/starter/pom.xml @@ -10,7 +10,7 @@ se.swedenconnect.spring.saml.idp spring-saml-idp-parent - 2.3.0 + 2.3.1-SNAPSHOT Sweden Connect :: Spring SAML Identity Provider :: Spring Boot Starter