italia / spid-cie-php

Software Development Kit for easy SPID/CIE access integration with simplesamlphp - developed and mantained by Michele D'Amico @damikael
https://italia.github.io/spid-cie-php/
Apache License 2.0
82 stars 39 forks source link

non funziona e non restituisce errori #6

Closed simevo closed 6 years ago

simevo commented 6 years ago

che fare ?

damikael commented 6 years ago

Verificare che il codice del file in: /myservice/../templates/selectidp-links.php sia coerente con quello del template in: spid-php/setup/templates/selectidp-links.tpl

In caso contrario l'installazione non è avvenuta correttamente.

Inoltre verificare i permessi sul file selectidp-links.php

simevo commented 6 years ago
$ diff ./setup/templates/selectidp-links.tpl ./vendor/simplesamlphp/simplesamlphp/templates/selectidp-links.php
32,33c32,33
<         <link rel="stylesheet" href="/{{SERVICENAME}}/css/agid-spid-enter.css">
<         <link rel="icon" type="image/ico" href="/{{SERVICENAME}}/img/favicon.ico">
---
>         <link rel="stylesheet" href="/myservice/css/agid-spid-enter.css">
>         <link rel="icon" type="image/ico" href="/myservice/img/favicon.ico">
61c61
<         <script type="text/javascript" src="/{{SERVICENAME}}/js/agid-spid-enter.js" ></script>
---
>         <script type="text/javascript" src="/myservice/js/agid-spid-enter.js" ></script>

sembra OK

verifico che l'utente www-data possa leggere il file selectidp-links.php:

sudo su - www-data -s /bin/sh -c 'cat /srv/spid-php/vendor/simplesamlphp/simplesamlphp/templates/selectidp-links.php'

e lo può leggere

però trovo questo in vendor/simplesamlphp/simplesamlphp/log/simplesamlphp.log:

Jun 14 15:03:08 simplesamlphp DEBUG [afccd751b2] Session: 'service-l1' not valid because we are not authenticated.
Jun 14 15:03:10 simplesamlphp DEBUG [afccd751b2] Session: 'service-l1' not valid because we are not authenticated.
Jun 14 15:03:11 simplesamlphp DEBUG [afccd751b2] Session: 'service-l1' not valid because we are not authenticated.
Jun 14 15:03:11 simplesamlphp DEBUG [afccd751b2] Saved state: '_b111a67e0a7547cc9b85d610622b5f518fab9bd9fe:https://spid.simevo.com/myservice/module.php/core/as_login.php?AuthId=service-l1&ReturnTo=https%3A%2F%2Fspid.simevo.com%2F'
Jun 14 15:03:11 simplesamlphp INFO [afccd751b2] idpDisco.saml: Accessing discovery service.
Jun 14 15:03:11 simplesamlphp INFO [afccd751b2] idpDisco.saml: returnIdParam initially set to [idpentityid]
Jun 14 15:03:11 simplesamlphp INFO [afccd751b2] idpDisco.saml: isPassive initially set to [FALSE]
Jun 14 15:03:11 simplesamlphp INFO [afccd751b2] idpDisco.saml: getSelectedIdP() returned null
Jun 14 15:03:11 simplesamlphp DEBUG [afccd751b2] Template: Reading [/srv/spid-php/vendor/simplesamlphp/simplesamlphp/dictionaries/disco]
Jun 14 15:03:11 simplesamlphp ERROR [afccd751b2] SimpleSAML_Error_Exception: Error 1 - Call to undefined method SimpleSAML_XHTML_Template::getTranslator()
Jun 14 15:03:11 simplesamlphp ERROR [afccd751b2] Backtrace:
Jun 14 15:03:11 simplesamlphp ERROR [afccd751b2] 2 /srv/spid-php/vendor/simplesamlphp/simplesamlphp/www/_include.php:84 (SimpleSAML_error_handler)
Jun 14 15:03:11 simplesamlphp ERROR [afccd751b2] 1 /srv/spid-php/vendor/simplesamlphp/simplesamlphp/www/_include.php:52 (SimpleSAML_exception_handler)
Jun 14 15:03:11 simplesamlphp ERROR [afccd751b2] 0 [builtin] (N/A)
simevo commented 6 years ago

cancellando le linee da 3 a 25 di https://github.com/italia/spid-php/blob/master/setup/templates/selectidp-links.tpl#L3 il problema svanisce e appare la pagina di scelta degli IDP

damikael commented 6 years ago

Sembra non trovi il metodo SimpleSAML_XHTML_Template::getTranslator(). Si sono verificati errori durante l'esecuzione di composer install? Il seguente file corrisponde? https://github.com/simplesamlphp/simplesamlphp/blob/master/lib/SimpleSAML/XHTML/Template.php

simevo commented 6 years ago

Ho inserito una stampa di debug in selectidp-links.php:

echo print_r($this);

e si vede che $this è un oggetto di tipo SimpleSAML_XHTML_Template quindi file Template.php è stato processato.

Leggendo quest'ultimo però ho notato che il metodo getTranslator non è presente: sembra che si possa chiamare direttamente $this->includeInlineTranslation, segue PR...

simevo commented 6 years ago

vedi: https://github.com/italia/spid-php/pull/16

damikael commented 6 years ago

Quale versione di SimpleSAMLphp si sta utilizzando?

Nelle ultime versioni, ed in particolare nell'ultima versione rilasciata (1.15.4) il metodo getTranslator è presente, mentre è deprecato richiamare direttamente includeInLineTranslation

    /**
     * Wraps Translate->includeInlineTranslation()
     *
     * @see \SimpleSAML\Locale\Translate::includeInlineTranslation()
     * @deprecated This method will be removed in SSP 2.0. Please use
     * \SimpleSAML\Locale\Translate::includeInlineTranslation() instead.
     */
    public function includeInlineTranslation($tag, $translation)
    {
        $this->translator->includeInlineTranslation($tag, $translation);
    }

https://github.com/simplesamlphp/simplesamlphp/blob/simplesamlphp-1.15/lib/SimpleSAML/XHTML/Template.php

Inoltre, la parte di codice che si vorrebbe modificare del file selectidp-links.php con la PR #16 è identica a quella del file originale del repository SimpleSAMLphp:

https://github.com/simplesamlphp/simplesamlphp/blob/simplesamlphp-1.15/templates/selectidp-links.php

simevo commented 6 years ago

chi usa composer install come da README ma senza lockfile (vedi #22) riceve la versione di default di packagist che al momento è la 1.16.0-rc1