At the time of writing, Spring SAML is in version 1.0.1.FINAL. It does not support multi-user cleanliness out of the box. I found another way to achieve multi-tenancy, in addition to the proposals made by Vladimir at the top. It is very simple and straightforward and does not require the extension of any Spring SAML classes. Additionally, it uses Spring SAML's built-in alias handling in the CachingMetadataManager .
In the controller, grab the tenant name from the request and create an ExtendedMetadata object using the tenant name as an alias. Then create ExtendedMetadataDelegate from ExtendedMetadata and initialize it. Parse entity identifiers from it and check if they exist in the MetadataManager . If they do not exist, add vendor metadata and updates. Then enter the object identifier from MetadataManager using getEntityIdForAlias() .
Here is the code for the controller. There are comments explaining some reservations:
@Controller public class SAMLController { @Autowired MetadataManager metadataManager; @Autowired ParserPool parserPool; @RequestMapping(value = "/login.do", method = RequestMethod.GET) public ModelAndView login(HttpServletRequest request, HttpServletResponse response, @RequestParam String tenantName) throws MetadataProviderException, ServletException, IOException{
I believe that this directly solves the problem of OP in order to find out how to get an IDP for a given tenant. But this will only work for IDPs with a single object identifier.
source share