[java-oidc-common] branch main updated: Removed the deprecated 'refreshTokenLifetime' profile configuration property.

Henri Mikkonen henri.mikkonen at iki.fi
Fri Sep 8 09:50:29 UTC 2023


This is an automated email from the git hooks/post-receive script.

hjmikkon pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=0a8e5ac2e11b9359322606effab400764b6b13dd

The following commit(s) were added to refs/heads/main by this push:
     new 0a8e5ac  Removed the deprecated 'refreshTokenLifetime' profile configuration property.
0a8e5ac is described below

commit 0a8e5ac2e11b9359322606effab400764b6b13dd
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Fri Sep 8 12:44:02 2023 +0300

    Removed the deprecated 'refreshTokenLifetime' profile configuration property.
---
 .../RefreshTokenLifetimeLookupFunction.java        | 55 ----------------------
 ...2RefreshTokenProducingProfileConfiguration.java | 14 ------
 .../config/impl/AbstractOIDCSSOConfiguration.java  | 38 ---------------
 .../impl/OIDCCoreProtocolConfigurationTest.java    | 17 -------
 4 files changed, 124 deletions(-)

diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/navigate/RefreshTokenLifetimeLookupFunction.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/navigate/RefreshTokenLifetimeLookupFunction.java
deleted file mode 100644
index b961e7c..0000000
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/navigate/RefreshTokenLifetimeLookupFunction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 net.shibboleth.oidc.profile.config.navigate;
-
-import java.time.Duration;
-
-import javax.annotation.Nullable;
-
-import org.opensaml.profile.context.ProfileRequestContext;
-
-import net.shibboleth.profile.config.ProfileConfiguration;
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.profile.context.navigate.AbstractRelyingPartyLookupFunction;
-import net.shibboleth.oidc.profile.oauth2.config.OAuth2RefreshTokenProducingProfileConfiguration;
-
-/**
- * A function that returns
- * {@link OAuth2RefreshTokenProducingProfileConfiguration#getRefreshTokenLifetime(ProfileRequestContext)}
- * if such a profile is available from a {@link RelyingPartyContext} obtained via a lookup function,
- * by default a child of the {@link ProfileRequestContext}.
- * 
- * <p>If a specific setting is unavailable, a null value is returned.</p>
- * 
- * @deprecated use {@link RefreshTokenTimeoutLookupFunction}
- */
- at Deprecated(since = "2.2.0", forRemoval=true)
-public class RefreshTokenLifetimeLookupFunction extends AbstractRelyingPartyLookupFunction<Duration> {
-
-    /** {@inheritDoc} */
-    @Override
-    @Nullable public Duration apply(@Nullable final ProfileRequestContext input) {
-        final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
-        if (rpc != null) {
-            final ProfileConfiguration pc = rpc.getProfileConfig();
-            if (pc instanceof OAuth2RefreshTokenProducingProfileConfiguration) {
-                return ((OAuth2RefreshTokenProducingProfileConfiguration) pc).getRefreshTokenLifetime(input);
-            }
-        }
-        
-        return null;
-    }
-
-}
\ No newline at end of file
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2RefreshTokenProducingProfileConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2RefreshTokenProducingProfileConfiguration.java
index 649ebe5..d1cbdf2 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2RefreshTokenProducingProfileConfiguration.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2RefreshTokenProducingProfileConfiguration.java
@@ -29,20 +29,6 @@ import net.shibboleth.shared.annotation.constraint.Positive;
  */
 public interface OAuth2RefreshTokenProducingProfileConfiguration extends OAuth2ProfileConfiguration {
 
-    /**
-     * Get refresh token lifetime.
-     * 
-     * <p>Defaults to 2 hours.</p>
-     * 
-     * @param profileRequestContext profile request context
-     * 
-     * @return refresh token lifetime
-     * 
-     * @deprecated Use {@link #getRefreshTokenTimeout(ProfileRequestContext)}
-     */
-    @Deprecated(since = "2.2.0", forRemoval=true)
-    @Nonnull @Positive Duration getRefreshTokenLifetime(@Nullable final ProfileRequestContext profileRequestContext);
-    
     /**
      * Get refresh token timeout. The expiration of a single refresh token is calculated based on this value.
      * 
diff --git a/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/AbstractOIDCSSOConfiguration.java b/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/AbstractOIDCSSOConfiguration.java
index 0dc4595..3b3fcc6 100644
--- a/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/AbstractOIDCSSOConfiguration.java
+++ b/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/AbstractOIDCSSOConfiguration.java
@@ -335,44 +335,6 @@ public abstract class AbstractOIDCSSOConfiguration extends AbstractOAuth2FlowAwa
         accessTokenLifetimeLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
     }
     
-    @Override
-    @Nonnull @Positive
-    @Deprecated(since = "2.2.0", forRemoval=true)
-    public Duration getRefreshTokenLifetime(@Nullable final ProfileRequestContext profileRequestContext) {
-        final Duration lifetime = refreshTokenLifetimeLookupStrategy.apply(profileRequestContext);
-        
-        Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
-                "Refresh token lifetime must be greater than 0");
-        return lifetime;
-    }
-
-    /**
-     * Set the lifetime of refresh token.
-     * 
-     * @param lifetime lifetime of an refresh token
-     * 
-     * @deprecated Use {@link #setRefreshTokenTimeout(Duration)}
-     */
-    @Deprecated(since = "2.2.0", forRemoval=true)
-    public void setRefreshTokenLifetime(@Nonnull @Positive final Duration lifetime) {
-        DeprecationSupport.warnOnce(ObjectType.METHOD, "setRefreshTokenLifetime",
-                getClass().getCanonicalName(), "setRefreshTokenTimeout");
-        setRefreshTokenTimeout(lifetime);
-    }
-
-    /**
-     * Set a lookup strategy for the refresh token lifetime.
-     *
-     * @param strategy lookup strategy
-     * 
-     * @deprecated Use {@link #setRefreshTokenTimeoutLookupStrategy(Function)}
-     */
-    @Deprecated(since = "2.2.0", forRemoval=true)
-    public void setRefreshTokenLifetimeLookupStrategy(
-            @Nullable final Function<ProfileRequestContext,Duration> strategy) {
-        refreshTokenLifetimeLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
-    }
-
     @Override
     @Nonnull @Positive
     public Duration getRefreshTokenTimeout(@Nullable final ProfileRequestContext profileRequestContext) {
diff --git a/oidc-common-profile-impl/src/test/java/net/shibboleth/oidc/profile/config/impl/OIDCCoreProtocolConfigurationTest.java b/oidc-common-profile-impl/src/test/java/net/shibboleth/oidc/profile/config/impl/OIDCCoreProtocolConfigurationTest.java
index 8199570..cd5d48c 100644
--- a/oidc-common-profile-impl/src/test/java/net/shibboleth/oidc/profile/config/impl/OIDCCoreProtocolConfigurationTest.java
+++ b/oidc-common-profile-impl/src/test/java/net/shibboleth/oidc/profile/config/impl/OIDCCoreProtocolConfigurationTest.java
@@ -50,7 +50,6 @@ public class OIDCCoreProtocolConfigurationTest {
         Assert.assertEquals(config.getAuthorizeCodeLifetime(null), Duration.ofMinutes(5));
         Assert.assertEquals(config.getIDTokenLifetime(null), Duration.ofHours(1));
         Assert.assertEquals(config.getAccessTokenLifetime(null), Duration.ofMinutes(10));
-        Assert.assertEquals(config.getRefreshTokenLifetime(null), Duration.ofHours(2));
         Assert.assertEquals(config.getRefreshTokenTimeout(null), Duration.ofHours(2));
         Assert.assertEquals(config.getRefreshTokenChainLifetime(null), Duration.ofHours(2));
         Assert.assertFalse(config.isAcrRequestAlwaysEssential(null));
@@ -75,22 +74,6 @@ public class OIDCCoreProtocolConfigurationTest {
                         new AuthenticationContextClassReferencePrincipal("value")));
     }
 
-    @Test
-    void testsetRefreshTokenLifetime() {
-        Assert.assertEquals(config.getRefreshTokenTimeout(null), Duration.ofHours(2));
-        config.setRefreshTokenLifetime(Duration.ofMillis(100));
-        // the deprecated setter sets the timeout
-        Assert.assertEquals(config.getRefreshTokenTimeout(null), Duration.ofMillis(100));
-    }
-
-    @Test
-    void testsetRefreshTokenLifetimeLookupStrategy() {
-        Assert.assertEquals(config.getRefreshTokenTimeout(null), Duration.ofHours(2));
-        config.setRefreshTokenLifetimeLookupStrategy(prc -> Duration.ofMillis(100));
-        // the deprecated setter function should be used in getter for timeout
-        Assert.assertEquals(config.getRefreshTokenTimeout(null), Duration.ofMillis(100));
-    }
-
     @Test
     void testsetRefreshTokenTimeout() {
         Assert.assertEquals(config.getRefreshTokenTimeout(null), Duration.ofHours(2));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list