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

wrap component in a class and minimize exposed surface #13

Closed
simevo opened this issue Jul 19, 2018 · 4 comments
Closed

wrap component in a class and minimize exposed surface #13

simevo opened this issue Jul 19, 2018 · 4 comments

Comments

@simevo
Copy link
Owner

simevo commented Jul 19, 2018

No description provided.

@simevo
Copy link
Owner Author

simevo commented Jul 19, 2018

also see: italia/spid-cie-php#24

@simevo
Copy link
Owner 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)
    {
    }
}

@simevo
Copy link
Owner Author

simevo commented Aug 3, 2018

most of this interface is now implemented in the feature/class-wrapper branch.

once that is mostly completed, we should:

  • merge the branch
  • check one by one if all the functionalities are implemented, creating point issues if necessary
  • and finally now close this one

lorenzocattaneo pushed a commit that referenced this issue Aug 11, 2018
@simevo
Copy link
Owner Author

simevo commented Aug 13, 2018

closed by PR #26

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