italia / spid-sp-shibboleth

Middleware SPID basato su Shibboleth
Creative Commons Zero v1.0 Universal
13 stars 5 forks source link

[SPID Quality Assessment] Elemento NameQualifier #20

Open peppelinux opened 3 years ago

peppelinux commented 3 years ago
ERROR:spid_sp_test:Test [48] Attributo NameQualifier di NameID dell'Assertion non specificato. Risultato atteso: KO: : [http status_code: 200] : FAILED
ERROR:spid_sp_test:Test [49] Attributo NameQualifier di NameID dell'Assertion mancante. Risultato atteso: KO: : [http status_code: 200] : FAILED
peppelinux commented 3 years ago

@francescm @robertogallea Closed by https://github.com/italia/spid-sp-shibboleth/pull/27?

francescm commented 3 years ago

Purtroppo no.

27 Risolve Request check strict: Test the compliance of Issuer element

[2] The Issuer's value must be equal to entityID - TR pag. 9

francescm commented 3 years ago

Qui siamo sempre nel reame di https://github.com/italia/spid-regole-tecniche/issues/15

ziobob94 commented 6 months ago

Salve a tutti,

Volevo condividere una soluzione al problema che ho risolto, il quale è dettagliatamente spiegato nella documentazione ufficiale delle Regole Tecniche.

Contrariamente a quanto indicato nella documentazione, per garantire che il campo "NameQualifier" venga accettato, è necessario aggiungere l'elemento <saml:Subject>

Ecco il template che ho elaborato:

` <samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
ID="{ID}" Version="2.0" IssueInstant="{IssueInstant}" Destination="{Destination}" AssertionConsumerServiceURL="{AssertionConsumerServiceURL}" ProtocolBinding="{ProtocolBinding}" AttributeConsumingServiceIndex="{AttributeConsumingServiceIndex}" ForceAuthn="{ForceAuthn}"> <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" NameQualifier="{NameQualifier}">{NameQualifier}</saml:Issuer>

{NameQualifier} https://www.spid.gov.it/SpidL{Level} ` Fate attenzione alla generazione dell'ID. Vi fornisco anche la funzione per generarlo: ` export function generateAuthnRequestId() { const validStartChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'; const validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'; let generatedString = validStartChars.charAt(Math.floor(Math.random() * validStartChars.length)); const remainingLength = 42 - 1; for (let i = 0; i < remainingLength; i++) { generatedString += validChars.charAt(Math.floor(Math.random() * validChars.length)); } return generatedString; } ` Ricordatevi di firmare questo documento nel caso del BINDING: Post.