Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document XMLObject retreival for Asserting Party metadata #12667

Closed
jzheaux opened this issue Feb 13, 2023 · 8 comments
Closed

Document XMLObject retreival for Asserting Party metadata #12667

jzheaux opened this issue Feb 13, 2023 · 8 comments
Assignees
Labels
in: docs An issue in Documentation or samples type: bug A general bug
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Feb 13, 2023

Related to #12664

An application using RelyingPartyRegistrations can retrieve the underlying OpenSAML XMLObject for each asserting party like so:

RelyingPartyRegistration registration = // ...
OpenSamlAssertingPartyDetails details = (OpenSamlAssertingPartyDetails) 
        registration.getAssertingPartyDetails();
EntityDescriptor description = details.getEntityDescriptor();

This should be documented in on SAML Metadata reference page.

Since this feature is available as of 5.7, please add the documentation on the 5.7.x branch.

@jzheaux jzheaux added in: docs An issue in Documentation or samples type: enhancement A general enhancement status: ideal-for-contribution An issue that we actively are looking for someone to help us with labels Feb 13, 2023
@jzheaux jzheaux modified the milestones: 5.8.x, 5.7.x Feb 13, 2023
@stnor
Copy link

stnor commented Feb 13, 2023

I am getting an error when doing the cast to OpenSamlAssertingPartyDetails

org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration$AssertingPartyDetails cannot be cast to class org.springframework.security.saml2.provider.service.registration.OpenSamlAssertingPartyDetails (org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration$AssertingPartyDetails and org.springframework.security.saml2.provider.service.registration.OpenSamlAssertingPartyDetails are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @31ce1b64)
java.lang.ClassCastException: class org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration$AssertingPartyDetails cannot be cast to class org.springframework.security.saml2.provider.service.registration.OpenSamlAssertingPartyDetails (org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration$AssertingPartyDetails and org.springframework.security.saml2.provider.service.registration.OpenSamlAssertingPartyDetails are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @31ce1b64)

I am loading the repo with the following code (based on the refreshable example)

        SkolfedRelyingPartyRegistrations
                .collectionFromMetadataLocation("https://fed.skolfederation.se/prod/md/skolfederation-3_1.xml")
                .forEach(builder -> {
                    RelyingPartyRegistration idp = builder.build();
                    this.relyingPartyRegistrations.put(idp.getRegistrationId(), idp);
                });

@stnor
Copy link

stnor commented Feb 13, 2023

AssertingPartyDetails doesnt seem to be a subclass of OpenSamlAssertingPartyDetails nor share any interfaces.

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 13, 2023

@stnor, it's the other way around. OpenSamlAssertingPartyDetails extends RelyingPartyRegistration.AssertingPartyDetails.

See the code that uses OpenSamlAssertingPartyDetails for reference.

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 13, 2023

My mistake, @stnor. My understanding was that this was already supported. I believe this was the intent of #10781. What needs to happen now is the details object that was created needs to be applied to the RelyingPartyRegistration (whereas right now it is copied).

@jzheaux jzheaux added type: bug A general bug and removed type: enhancement A general enhancement status: ideal-for-contribution An issue that we actively are looking for someone to help us with labels Feb 13, 2023
@jzheaux jzheaux self-assigned this Feb 13, 2023
@jzheaux jzheaux modified the milestones: 5.7.x, 5.7.7 Feb 13, 2023
@stnor
Copy link

stnor commented Feb 13, 2023

Right, that makes sense to me. I'm a bit tired here, but as I was looking at the code I couldnt see that this would ever work :D

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 16, 2023

@stnor, I'll go ahead and submit a fix. Some of the 5.x deprecations in RelyingPartyRegistration make it a bit tricky.

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 17, 2023

@stnor, I've pushed a change. The snapshots should be available momentarily. Will you please confirm the version you are using and that the fix works for you?

@stnor
Copy link

stnor commented Feb 18, 2023

Yup, works on 5.8.2-SNAPSHOT. Thanks!

jzheaux added a commit that referenced this issue Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: docs An issue in Documentation or samples type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants