dej611 / spid-react-button

Pulsante SSO per SPID in React
https://dej611.github.io/spid-react-button/
European Union Public License 1.2
18 stars 15 forks source link

Adding the demo validation IDP and the AgID IDP turns every IDP unclickable #120

Open fautore opened 6 months ago

fautore commented 6 months ago

Hi, first of all, thank you so much for the work on this repo, as the title says, I integrated the button in a react application, all is working fine, but when it comes to adding the AgID IDP for validation (https://validator.spid.gov.it/) using the extraProviders configuration option turns Every IDP button (including the new one) unclickable.

Any suggestions on how to fix? is the configuration (down here) i'm using wrong by any means?

<SPIDReactButton
    url={`${window.location.protocol}//${window.location.host}/authentication/spid?idp={{idp}}`}
    extraProviders: [{
        entityID: 'https://validator.spid.gov.it',
        entityName: 'VALIDATOR'
    }]
/>

Edit: Did some digging...

The issue seems occuring in ProvidersModal.tsx, line 174 the function isProviderActive correctly acknowledges that the idp is an extra provider, BUT the first theck supported.indexOf(idp.entityID) returns false.

supported is a list of entities that are registered Identity Providers (e.g. list at time of writing):

supported: [ 
  "https://identity.sieltecloud.it",
  "https://spid.intesa.it",
  "https://identity.infocert.it",
  "https://id.lepida.it/idp/shibboleth",
  "https://spid.register.it",
  "https://login.id.tim.it/affwebservices/public/saml2sso", 
  "https://posteid.poste.it",
  "https://loginspid.aruba.it",
  "https://idp.namirialtsp.com/idp" 
  "https://spid.teamsystem.com/idp"
]

Obviously, my extra provider is NOT on the list, hence why the isProviderActive function returns false even when the provider is a custom one.

fautore commented 6 months ago

Opened a PR to fix, please check!