diff --git a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistration.java b/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistration.java deleted file mode 100644 index 300fd4d107..0000000000 --- a/saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistration.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2002-2025 the original author or authors. - * - * 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 - * - * https://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 org.springframework.security.saml2.provider.service.registration; - -import java.util.Collection; -import java.util.function.Consumer; - -import org.opensaml.saml.saml2.metadata.EntityDescriptor; - -import org.springframework.security.saml2.core.Saml2X509Credential; - -/** - * An OpenSAML implementation of {@link RelyingPartyRegistration} that contains OpenSAML - * objects like {@link EntityDescriptor}. - * - * @author Josh Cummings - * @since 6.1 - * @deprecated This class no longer is needed in order to transmit the - * {@link EntityDescriptor} to {@link OpenSamlAssertingPartyDetails}. Instead of doing: - *
- * if (registration instanceof OpenSamlRelyingPartyRegistration openSamlRegistration) {
- * EntityDescriptor descriptor = openSamlRegistration.getAssertingPartyDetails.getEntityDescriptor();
- * }
- * do instead:
- * if (registration.getAssertingPartyMetadata() instanceof openSamlAssertingPartyDetails) {
- * EntityDescriptor descriptor = openSamlAssertingPartyDetails.getEntityDescriptor();
- * }
- *
- */
-@Deprecated
-public final class OpenSamlRelyingPartyRegistration extends RelyingPartyRegistration {
-
- OpenSamlRelyingPartyRegistration(RelyingPartyRegistration registration) {
- super(registration.getRegistrationId(), registration.getEntityId(),
- registration.getAssertionConsumerServiceLocation(), registration.getAssertionConsumerServiceBinding(),
- registration.getSingleLogoutServiceLocation(), registration.getSingleLogoutServiceResponseLocation(),
- registration.getSingleLogoutServiceBindings(),
- (OpenSamlAssertingPartyDetails) registration.getAssertingPartyMetadata(),
- registration.getNameIdFormat(), registration.isAuthnRequestsSigned(),
- registration.getDecryptionX509Credentials(), registration.getSigningX509Credentials());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public OpenSamlRelyingPartyRegistration.Builder mutate() {
- OpenSamlAssertingPartyDetails party = (OpenSamlAssertingPartyDetails) getAssertingPartyMetadata();
- return new Builder(party).registrationId(getRegistrationId())
- .entityId(getEntityId())
- .signingX509Credentials((c) -> c.addAll(getSigningX509Credentials()))
- .decryptionX509Credentials((c) -> c.addAll(getDecryptionX509Credentials()))
- .assertionConsumerServiceLocation(getAssertionConsumerServiceLocation())
- .assertionConsumerServiceBinding(getAssertionConsumerServiceBinding())
- .singleLogoutServiceLocation(getSingleLogoutServiceLocation())
- .singleLogoutServiceResponseLocation(getSingleLogoutServiceResponseLocation())
- .singleLogoutServiceBindings((c) -> c.addAll(getSingleLogoutServiceBindings()))
- .nameIdFormat(getNameIdFormat())
- .authnRequestsSigned(isAuthnRequestsSigned());
- }
-
- /**
- * Create a {@link Builder} from an entity descriptor
- * @param entityDescriptor the asserting party's {@link EntityDescriptor}
- * @return an {@link Builder}
- */
- public static OpenSamlRelyingPartyRegistration.Builder withAssertingPartyEntityDescriptor(
- EntityDescriptor entityDescriptor) {
- return new Builder(entityDescriptor);
- }
-
- /**
- * An OpenSAML version of
- * {@link org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration.AssertingPartyDetails.Builder}
- * that contains the underlying {@link EntityDescriptor}
- */
- public static final class Builder extends RelyingPartyRegistration.Builder {
-
- private Builder(EntityDescriptor entityDescriptor) {
- super(entityDescriptor.getEntityID(), OpenSamlAssertingPartyDetails.withEntityDescriptor(entityDescriptor));
- }
-
- Builder(OpenSamlAssertingPartyDetails details) {
- super(details.getEntityDescriptor().getEntityID(), details.mutate());
- }
-
- @Override
- public Builder registrationId(String id) {
- return (Builder) super.registrationId(id);
- }
-
- public Builder entityId(String entityId) {
- return (Builder) super.entityId(entityId);
- }
-
- public Builder signingX509Credentials(Consumer