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

Support for multiple identity providers is faulty #72

Open
ilPittiz opened this issue Oct 7, 2021 · 0 comments
Open

Support for multiple identity providers is faulty #72

ilPittiz opened this issue Oct 7, 2021 · 0 comments

Comments

@ilPittiz
Copy link

ilPittiz commented Oct 7, 2021

Having to support multiple IDPs, I pulled the project to make some configuration tests.

I made adjustments to application.yml configuration, e.g.

grails:
    plugin:
        springsecurity:
            saml:
                [...]
                metadata:
                    providers:
                        aliasA: '/path/to/metadata_A.xml'
                [...]

and verified that all metadata, taken singularly, are loaded as expected.

When trying to add all of them at the same time though, e.g.

grails:
    plugin:
        springsecurity:
            saml:
                [...]
                metadata:
                    providers:
                        aliasA: '/path/to/metadata_A.xml'
                        aliasB: '/path/to/metadata_B.xml'
                        aliasC: '/path/to/metadata_C.xml'
                [...]

and with logging enabled on logback.groovy
logger 'org.grails.plugin.springsecurity.saml', DEBUG, ['STDOUT'], true

On application startup I can see on stdout

Registering metadata key: aliasA and value: /path/to/metadata_A.xml
Registering metadata key: aliasB and value: /path/to/metadata_B.xml
Registering metadata key: aliasC and value: /path/to/metadata_C.xml

but instead, loading https://localhost:8080/metadata/index shows only the idpName of the last provider in the configuration.

Printing a few data on MetadataController.index():

> println metadata.providers    // or metadata.availableProviders
[ org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider@37196d53, 
  org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider@37196d53,
  org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider@37196d53,
  org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider@3e4636c3 ]
> println metadata.providers.collect { metadata.parseProvider(it) }
[ ['ipdNameC'], ['ipdNameC'], ['ipdNameC'], ['spName'] ]

confirms that 3 IDPs were loaded but they're all the very same instance.

Checking the plugin's initializer SpringSecuritySamlGrailsPlugin.groovy#L146, I see there are beans and nested beans' definitions (each with constructor args), but as far as I know beans are singletons by default, so this might be the culprit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant