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

SPID_PHP -> classe astratta, l'attuale diventa SPID_PHP_SimpleSAMLphp che implementa SPID_PHP #24

Closed
simevo opened this issue Jun 29, 2018 · 2 comments

Comments

@simevo
Copy link

simevo commented Jun 29, 2018

l'obiettivo di questo pacchetto composer dovrebbe essere fornire una classe SPID astratta, che maschera SimpleSAMLphp
in questo modo tutti gli applicativi e le librerie basate su spid-php non avranno una dipendenza esplicita dalle API di SimpleSAMLphp

inizialmente spid-php usa SimpleSAMLphp ma è installabile e autoconfigurante con composer install: chi lo usa non dovrebbe mettere le mani in SimpleSAMLphp né usare la sua API

un domani spid-php potrebbe essere re-implementata in modo nativo eliminando la dipendenza da SimpleSAMLphp; se manteniamo costante l’interfaccia, non impatteremo gli utilizzatori

@damikael
Copy link
Member

damikael commented Jul 2, 2018

L'utilizzo attuale di spid-php, come indicato nel readme, è finalizzato a semplificare e automatizzare il processo di installazione e configurazione di SimpleSAMLphp (https://simplesamlphp.org/) per l'integrazione dell'autenticazione SPID all'interno di applicazioni PHP tramite lo spid-smart-button.

Tuttavia, già ora, gli applicativi e le librerie basate su spid-php non hanno una dipendenza esplicita da SimpleSAMLphp perchè è possibile utilizzare i metodi d'interfaccia esposti dalla classe SPID_PHP e documentati nel readme.

D'accordo per formalizzare SPID_PHP come classe astratta e spostare l'attuale implementazione in una classe SPID_PHP_SimpleSAMLphp che la implementa.

@simevo simevo changed the title design requirement: astrarre da SimpleSAMLphp SPID_PHP -> classe astratta, l'attuale diventa SPID_PHP_SimpleSAMLphp che implementa SPID_PHP Jul 2, 2018
@simevo
Copy link
Author

simevo commented Jul 25, 2018

prototype:

abstract class SPID
{

    // $settings = array(
    //     'entityId' => 'https://example.com/myservice', // https protocol, no trailing slash
    //     'sls' => '/?sls', // path relative to entityId base url or full url
    //     'assCs' => array( // order is important ! the 0-base index in this array will be used as assertion consuming service index in the API calls
    //         '/?acs1', // path relative to entityId base url or full url
    //         '/acs2/?test',
    //     ),
    //     'attrCs' => array( // order is important ! the 0-base index in this array will be used as attribute consuming service index in the API calls
    //         array('name', 'familyName', 'fiscalNumber', 'email'),
    //         array('fiscalNumber', 'email')
    //     ),
    //     'organisationName' => 'xxx', // optional
    //     'organizationUrl' => 'xxx', // optional
    //     'keyFile' => '/srv/spid-wordpress/sp.key',
    //     'certFile' => '/srv/spid-wordpress/sp.crt',
    //     'caCertFile' => '/srv/spid-wordpress/ca.crt', // optional (if null or empty will skip IdP metadata signatures verification)
    //     'idp' => array(
    //         '/srv/spid-wordpress/testenv2.xml', // 0 = Test IDP
    //         '/srv/spid-wordpress/idp_1.xml',    // 1 = Infocert ID
    //         '/srv/spid-wordpress/idp_2.xml',    // 2 = Poste ID
    //         '/srv/spid-wordpress/idp_3.xml',    // 3 = Tim ID
    //         '/srv/spid-wordpress/idp_4.xml',    // 4 = Sielte ID
    //         '/srv/spid-wordpress/idp_5.xml',    // 5 = Aruba ID
    //         '/srv/spid-wordpress/idp_6.xml',    // 6 = Namirial ID
    //         '/srv/spid-wordpress/idp_7.xml',    // 7 = SPIDItalia Register.it
    //         '/srv/spid-wordpress/idp_8.xml',    // 8 = Intesa ID
    //     )
    // );
    public function __construct($settings)
    {
    }

    // returns SP metadata as a string
    public function getMetadata()
    {
    }
        
    // returns an object that can be injected in javascript to ease spid-smart-button integration
    // {
    //   'https://loginspid.aruba.it': 0,
    //   ...
    //   'https://idp.namirialtsp.com/idp': 2,
    //   'https://posteid.poste.it': 3,
    //   ...
    //   'https://idp.example.com': 5,
    //   ...
    // }
    public function getMapping()
    {
    }
        
    // returns an array that can be injected in javascript to ease spid-smart-button integration
    // [
    //   'https://loginspid.aruba.it',
    //   ...
    //   'https://idp.namirialtsp.com/idp',
    //   'https://posteid.poste.it',
    //   ...
    //   'https://idp.example.com'.
    //   ...
    // ]
    public function getSupported()
    {
    }

    // if there is no response, returns false; else processes the response, reports errors if any, returns true if successful login
    public function isAuthenticated()
    {
    }

    // $idp: index of idp
    // $ass: index of assertion consumer service as per our metadata
    // $attr: index of attribute consuming service as per our metadata
    // $level: SPID level (1, 2 or 3)
    // $returnTo: return url
    public function login($idp, $ass, $attr, $level, $returnTo)
    {
    }
    
    public function logout()
    {
    }
    
    // returns attributes as an array or null if not authenticated, example: array('name' => 'Franco', 'familyName' => 'Rossi', 'fiscalNumber' => 'FFFRRR88A12T4441R',
    public function getAttributes()
    {
    }

    // returns value for a specific attribute or null if not authenticated
    public function getAttribute(string $attribute)
    {
    }
}

damikael pushed a commit that referenced this issue Mar 13, 2019
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

2 participants