The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Net::SPID - SPID implementation for Perl


version 0.15


    use Net::SPID;
    my $spid = Net::SPID->new(
        sp_entityid     => '',
        sp_key_file     => 'sp.key',
        sp_cert_file    => 'sp.pem',
    # load Identity Providers
    # or:
    # or:
    # get an IdP
    my $idp = $spid->get_idp('');
    # generate an AuthnRequest
    my $authnreq = $idp->authnrequest(
        acs_index   => 0,   # index of AssertionConsumerService as per our SP metadata
        attr_index  => 1,   # index of AttributeConsumingService as per our SP metadata
        level       => 1,   # SPID level
    # prepare a HTTP-Redirect binding
    my $url = $authnreq->redirect_url;


This Perl module is aimed at implementing SPID Service Providers and Attribute Authorities. SPID is the Italian digital identity system, which enables citizens to access all public services with single set of credentials. This module provides a layer of abstraction over the SAML protocol by exposing just the subset required in order to implement SPID authentication in a web application. In addition, it will be able to generate the HTML code of the SPID login button and enable developers to implement an Attribute Authority.

This module is not bound to any particular web framework, so you'll have to do some plumbing yourself in order to route protocol messages over HTTP (see the example/ directory for a full working example). On top of this module, plugins for web frameworks can be developed in order to achieve even more API abstraction.

See for a full feature list with details about SPID compliance.



A protocol argument may be supplied to new, with the saml (default) or openid value. According to this argument, a Net::SPID::SAML or a Net::SPID::OpenID object will be returned. See their documentation for the other arguments which can be supplied to new.




Alessandro Ranellucci <>


This software is Copyright (c) 2018 by Alessandro Ranellucci.

This is free software, licensed under:

  The (three-clause) BSD License