spring-projects / spring-projects/spring-boot
Reloading Saml2RelyingPartyRegistrations with help of Saml2RelyingPartyRegistrationConfiguration
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
The spring-security-saml extension provides a HTTPMetadataProvider which is able to automatically refresh SAML metadata in configurable intervals. It would be nice if this feature would also be supported by spring security, but I'm afraid that this feature is out of scope of this library (https://github.com/spring-projects/spring-security/issues/9134).
This is ok, because this feature can be realized fairly simple by implementing a custom RelyingPartyRegistrationRepository.
However the user has to write a lot of code that is already part of Spring Boot and Spring Security internally (e.g. reading certificates, thinking about configuration properties, ...).
It would be nice if a user could just use the existing Spring Boot SAML configuration like this (example on github):
public ReloadingRelyingPartyRegistrationRepository(Saml2RelyingPartyProperties properties) {
this.properties = properties;
refreshRelyingPartyRegistrations();
}
@Scheduled(fixedDelayString = "${metadata-refresh-interval}", initialDelay = 10_000)
private void refreshRelyingPartyRegistrations() {
LOGGER.debug("refreshRelyingPartyRegistrations");
properties.getRegistration().forEach((registrationId, registrationProperties) -> {
try {
registrations.put(registrationId, asRegistration(registrationId, registrationProperties));
}
catch (Exception e) {
LOGGER.warn("Could not refresh RelyingPartyRegistration configuration.", e);
}
});
}
My question is, would you consider making the private asRegistration(...) method from Saml2RelyingPartyRegistrationConfiguration in some form accessible to users, so that they don't have to repeat that code? Maybe not in Saml2RelyingPartyRegistrationConfiguration but in a separate utility class?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Saml2RelyingPartyRegistrationConfiguration and its private asRegistration(...) method, then review the linked AutoReloadingRelyingPartyRegistrationRepository example. Determine how the existing Spring Boot SAML configuration could be reused by users without duplicating certificate and property handling. Done means a considered reusable access point or utility for rebuilding registrations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- authentication, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100