[java-identity-provider] 19/19: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Wed Aug 10 13:17:11 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch maint-4
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=304c316ff79bac42c97faada41864d548c79bce5
commit 304c316ff79bac42c97faada41864d548c79bce5
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Aug 10 11:08:57 2022 +0100
IDP-1793 Use Suppliers for HttpRequest/Response
https://shibboleth.atlassian.net/browse/IDP-1793
net.shibboleth.idp.authn.revocation.impl.RevocationCacheCondition
Gains a setter/getter for a Supplier for the HttpServletRequest
and loses the setter for the raw object.
---
.../authn/revocation/impl/RevocationCacheCondition.java | 17 ++++++++++-------
.../resources/net/shibboleth/idp/conf/authn-system.xml | 2 +-
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java
index 2eef5c438..5801b10a2 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.function.BiPredicate;
import java.util.function.Function;
+import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -69,8 +70,8 @@ public class RevocationCacheCondition extends AbstractInitializableComponent
/** Lookup strategy for principal name. */
@NonnullAfterInit private Function<ProfileRequestContext,String> principalNameLookupStrategy;
- /** Servlet request. */
- @Nullable private HttpServletRequest httpServletRequest;
+ /** Servlet request Supplier. */
+ @Nullable private Supplier<HttpServletRequest> httpServletRequestSupplier;
/**
* Set {@link RevocationCache} to use.
@@ -99,13 +100,13 @@ public class RevocationCacheCondition extends AbstractInitializableComponent
/**
* Set {@link HttpServletRequest} in order to obtain client address.
*
- * @param request servlet request interface
+ * @param supplier servlet request interface
*/
- public void setHttpServletRequest(@Nullable final HttpServletRequest request) {
+ public void setHttpServletRequestSupplier(@Nullable final Supplier<HttpServletRequest> supplier) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
- httpServletRequest = request;
+ httpServletRequestSupplier = supplier;
}
/** {@inheritDoc} */
@@ -142,9 +143,11 @@ public class RevocationCacheCondition extends AbstractInitializableComponent
try {
final String principalRecord = revocationCache.getRevocationRecord(REVOCATION_CONTEXT,
PRINCIPAL_REVOCATION_PREFIX + principal);
- final String addressRecord = httpServletRequest != null ?
+ final HttpServletRequest request = httpServletRequestSupplier == null? null :
+ httpServletRequestSupplier.get();
+ final String addressRecord = request != null ?
revocationCache.getRevocationRecord(REVOCATION_CONTEXT,
- ADDRESS_REVOCATION_PREFIX + httpServletRequest.getRemoteAddr()) :
+ ADDRESS_REVOCATION_PREFIX + request.getRemoteAddr()) :
null;
final Collection<String> records = new ArrayList<>(2);
if (principalRecord != null) {
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/authn-system.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/authn-system.xml
index 8746328d7..845d164d5 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/authn-system.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/authn-system.xml
@@ -538,7 +538,7 @@
<bean id="shibboleth.RevocationCacheCondition" class="net.shibboleth.idp.authn.revocation.impl.RevocationCacheCondition" lazy-init="true"
p:revocationCache-ref="%{idp.authn.revocation.cache:shibboleth.AuthnRevocationCache}"
- p:httpServletRequest="#{%{idp.authn.revocation.addressBased:false} ? getObject('shibboleth.HttpServletRequest') : null}"
+ p:httpServletRequestSupplier="#{%{idp.authn.revocation.addressBased:false} ? getObject('shibboleth.HttpServletRequestSupplier') : null}"
p:principalNameLookupStrategy-ref="shibboleth.RevocationPrincipalLookupStrategy" />
<bean id="shibboleth.AttributeRevocationCondition" class="net.shibboleth.idp.authn.revocation.impl.AttributeRevocationCondition" lazy-init="true"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list