From 56631ec811827a7d957f408e1de1ae2c35b4129f Mon Sep 17 00:00:00 2001 From: Brent Halsey Date: Fri, 20 Dec 2024 16:03:22 -0700 Subject: [PATCH 1/2] 1.55.0 builders --- .../java/io/fusionauth/domain/APIKey.java | 7 +++++-- .../fusionauth/domain/JWTConfiguration.java | 7 ++++++- .../domain/RefreshTokenRevocationPolicy.java | 9 +++++--- .../fusionauth/domain/jwt/RefreshToken.java | 4 ++-- .../provider/BaseSAMLv2IdentityProvider.java | 21 ++++++++++++++++--- 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/fusionauth/domain/APIKey.java b/src/main/java/io/fusionauth/domain/APIKey.java index 05db7e3b..24a87a65 100644 --- a/src/main/java/io/fusionauth/domain/APIKey.java +++ b/src/main/java/io/fusionauth/domain/APIKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, FusionAuth, All Rights Reserved + * Copyright (c) 2021-2024, FusionAuth, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,8 @@ * @author sanjay */ public class APIKey implements Buildable { + public ZonedDateTime expirationInstant; + public UUID id; public ZonedDateTime insertInstant; @@ -68,6 +70,7 @@ public boolean equals(Object o) { } APIKey apiKey = (APIKey) o; return keyManager == apiKey.keyManager && + Objects.equals(expirationInstant, apiKey.expirationInstant) && Objects.equals(id, apiKey.id) && Objects.equals(insertInstant, apiKey.insertInstant) && Objects.equals(ipAccessControlListId, apiKey.ipAccessControlListId) && @@ -80,7 +83,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, insertInstant, ipAccessControlListId, key, keyManager, lastUpdateInstant, metaData, permissions, tenantId); + return Objects.hash(expirationInstant, id, insertInstant, ipAccessControlListId, key, keyManager, lastUpdateInstant, metaData, permissions, tenantId); } public void normalize() { diff --git a/src/main/java/io/fusionauth/domain/JWTConfiguration.java b/src/main/java/io/fusionauth/domain/JWTConfiguration.java index 3227928d..00634fa7 100644 --- a/src/main/java/io/fusionauth/domain/JWTConfiguration.java +++ b/src/main/java/io/fusionauth/domain/JWTConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023, FusionAuth, All Rights Reserved + * Copyright (c) 2019-2024, FusionAuth, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,8 @@ public class JWTConfiguration extends Enableable implements Buildable extends BaseIdentityProvider { + public SAMLv2AssertionDecryptionConfiguration assertionDecryptionConfiguration = new SAMLv2AssertionDecryptionConfiguration(); + public String emailClaim; /** @@ -36,15 +50,16 @@ public boolean equals(Object o) { return false; } BaseSAMLv2IdentityProvider that = (BaseSAMLv2IdentityProvider) o; - return useNameIdForEmail == that.useNameIdForEmail + return Objects.equals(assertionDecryptionConfiguration, that.assertionDecryptionConfiguration) && Objects.equals(emailClaim, that.emailClaim) && Objects.equals(keyId, that.keyId) && Objects.equals(uniqueIdClaim, that.uniqueIdClaim) + && useNameIdForEmail == that.useNameIdForEmail && Objects.equals(usernameClaim, that.usernameClaim); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), emailClaim, keyId, uniqueIdClaim, useNameIdForEmail, usernameClaim); + return Objects.hash(super.hashCode(), assertionDecryptionConfiguration, emailClaim, keyId, uniqueIdClaim, useNameIdForEmail, usernameClaim); } } From 9302693aacfcad96423caafba2f430c7a7e3e0d0 Mon Sep 17 00:00:00 2001 From: Brent Halsey Date: Fri, 20 Dec 2024 16:05:22 -0700 Subject: [PATCH 2/2] 1.55.0 builders --- .../RefreshTokenOneTimeUseConfiguration.java | 61 +++++++++++++++++++ ...AMLv2AssertionDecryptionConfiguration.java | 56 +++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 src/main/java/io/fusionauth/domain/RefreshTokenOneTimeUseConfiguration.java create mode 100644 src/main/java/io/fusionauth/domain/provider/SAMLv2AssertionDecryptionConfiguration.java diff --git a/src/main/java/io/fusionauth/domain/RefreshTokenOneTimeUseConfiguration.java b/src/main/java/io/fusionauth/domain/RefreshTokenOneTimeUseConfiguration.java new file mode 100644 index 00000000..737c38f9 --- /dev/null +++ b/src/main/java/io/fusionauth/domain/RefreshTokenOneTimeUseConfiguration.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ +package io.fusionauth.domain; + +import java.util.Objects; + +import com.inversoft.json.JacksonConstructor; +import com.inversoft.json.ToString; + +/** + * Refresh token one-time use configuration. This configuration is utilized when the usage policy is + * configured for one-time use. + * + * @author Daniel DeGroff + */ +public class RefreshTokenOneTimeUseConfiguration implements Buildable { + public int gracePeriodInSeconds; + + @JacksonConstructor + public RefreshTokenOneTimeUseConfiguration() { + } + + public RefreshTokenOneTimeUseConfiguration(RefreshTokenOneTimeUseConfiguration other) { + this.gracePeriodInSeconds = other.gracePeriodInSeconds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RefreshTokenOneTimeUseConfiguration that = (RefreshTokenOneTimeUseConfiguration) o; + return gracePeriodInSeconds == that.gracePeriodInSeconds; + } + + @Override + public int hashCode() { + return Objects.hash(gracePeriodInSeconds); + } + + @Override + public String toString() { + return ToString.toString(this); + } +} diff --git a/src/main/java/io/fusionauth/domain/provider/SAMLv2AssertionDecryptionConfiguration.java b/src/main/java/io/fusionauth/domain/provider/SAMLv2AssertionDecryptionConfiguration.java new file mode 100644 index 00000000..6b6ea34d --- /dev/null +++ b/src/main/java/io/fusionauth/domain/provider/SAMLv2AssertionDecryptionConfiguration.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ +package io.fusionauth.domain.provider; + +import java.util.Objects; +import java.util.UUID; + +import com.inversoft.json.ToString; +import io.fusionauth.domain.Enableable; + +/** + * Configuration for encrypted assertions when acting as SAML Service Provider + * + * @author Jaret Hendrickson + */ +public class SAMLv2AssertionDecryptionConfiguration extends Enableable { + public UUID keyTransportDecryptionKeyId; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof SAMLv2AssertionDecryptionConfiguration)) { + return false; + } + if (!super.equals(o)) { + return false; + } + SAMLv2AssertionDecryptionConfiguration that = (SAMLv2AssertionDecryptionConfiguration) o; + return Objects.equals(keyTransportDecryptionKeyId, that.keyTransportDecryptionKeyId); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), keyTransportDecryptionKeyId); + } + + @Override + public String toString() { + return ToString.toString(this); + } +}