[java-opensaml] 03/10: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Tue Aug 2 19:34:41 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch dev/4/IDP-1793
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=c31ec18f2457263cb2d61817760d331012e2f7cc
commit c31ec18f2457263cb2d61817760d331012e2f7cc
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Jul 30 15:22:42 2022 +0100
IDP-1793 Use Suppliers for HttpRequest/Response
https://shibboleth.atlassian.net/browse/IDP-1793
Refactor org.opensaml.saml.saml2.profile.impl.ValidateAssertions
1) The parent class already looks after the HttpServletRequest
so we don't need to.
2) The sub class AssertionValidationInput is not static so it
doesn't need to keep the HttpServletRequestEither, so just
ask for it on demand (which we need to do by way of the
Supplier because we cannot call
ValidateAssertions::getHttpServletRequest())
---
.../saml2/profile/impl/ValidateAssertions.java | 24 +++++++---------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertions.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertions.java
index 80b79cb6d..3162fced5 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertions.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/ValidateAssertions.java
@@ -61,9 +61,6 @@ public class ValidateAssertions extends AbstractProfileAction {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(ValidateAssertions.class);
- /** The HttpServletRequest being processed. */
- @NonnullAfterInit private HttpServletRequest httpServletRequest;
-
/** Flag which indicates whether a failure of Assertion validation should be considered fatal. */
private boolean invalidFatal;
@@ -149,8 +146,9 @@ public class ValidateAssertions extends AbstractProfileAction {
*
* @return the HTTP servlet request
*/
+ @Deprecated(forRemoval = true, since = "4.3")
@NonnullAfterInit public HttpServletRequest getHttpServletRequest() {
- return httpServletRequest;
+ return super.getHttpServletRequest();
}
/**
@@ -158,10 +156,11 @@ public class ValidateAssertions extends AbstractProfileAction {
*
* @param request The HTTP servlet request
*/
+ @Deprecated(forRemoval = true, since = "4.3")
public void setHttpServletRequest(@Nonnull final HttpServletRequest request) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
- httpServletRequest = request;
+ super.setHttpServletRequest(request);
}
/**
@@ -258,13 +257,6 @@ public class ValidateAssertions extends AbstractProfileAction {
}
}
- /** {@inheritDoc} */
- protected void doDestroy() {
- httpServletRequest = null;
-
- super.doDestroy();
- }
-
/** {@inheritDoc} */
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (!super.doPreExecute(profileRequestContext)) {
@@ -414,9 +406,6 @@ public class ValidateAssertions extends AbstractProfileAction {
/** The profile request context input. */
private ProfileRequestContext profileContext;
- /** The HTTP request input. */
- private HttpServletRequest httpServletRequest;
-
/** The Assertion being evaluated. */
private Assertion assertion;
@@ -430,7 +419,8 @@ public class ValidateAssertions extends AbstractProfileAction {
public AssertionValidationInput(@Nonnull final ProfileRequestContext context,
@Nonnull final HttpServletRequest request, @Nonnull final Assertion samlAssertion) {
profileContext = Constraint.isNotNull(context, "ProfileRequestContext may not be null");
- httpServletRequest = Constraint.isNotNull(request, "HttpServletRequest may not be null");
+ Constraint.isNotNull(request, "HttpServletRequest may not be null");
+ Constraint.isNotNull(getHttpServletRequest(), "HttpServletRequest may not be null");
assertion = Constraint.isNotNull(samlAssertion, "Assertion may not be null");
}
@@ -449,7 +439,7 @@ public class ValidateAssertions extends AbstractProfileAction {
* @return the HTTP servlet request input
*/
@Nonnull public HttpServletRequest getHttpServletRequest() {
- return httpServletRequest;
+ return getHttpServletRequestSupplier().get();
}
/**
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list