[java-identity-provider] 03/03: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Mon Aug 15 15:31:21 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=4befbc6261cf6a24fdeb43a94363800c8b2102bf
commit 4befbc6261cf6a24fdeb43a94363800c8b2102bf
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.
---
.../revocation/impl/RevocationCacheCondition.java | 20 +++++++++++---------
.../net/shibboleth/idp/conf/authn-system.xml | 2 +-
2 files changed, 12 insertions(+), 10 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 7865195c8..19c35dc51 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;
@@ -68,8 +69,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.
@@ -95,12 +96,11 @@ 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) {
checkSetterPreconditions();
-
- httpServletRequest = request;
+ httpServletRequestSupplier = supplier;
}
/** {@inheritDoc} */
@@ -138,9 +138,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) {
@@ -183,4 +185,4 @@ public class RevocationCacheCondition extends AbstractInitializableComponent
return false;
}
-}
\ No newline at end of file
+}
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 c2c4e3dbe..59b030c77 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