Net::SAML2::SP(3)
π Net::SAML2::SP π β the SAML Service Provider object (from the Perl man pages, bestie)
okay so picture this: you're the Service Provider. You're the one holding the door, checking the vibe of every assertion that walks in. That's this module. It's Net::SAML2::SP, it's version 0.85, and it is, genuinely, the main character of your whole SAML setup. π«Ά
β¨ NAME β¨
Net::SAML2::SP β the SAML Service Provider object. That's the whole vibe. She provides services. She speaks SAML. She signs things. π
π VERSION π
version 0.85 β yes, that's the version, no cap.
πΈ SYNOPSIS πΈ
like, here's how you actually birth one of these:
my $sp = Net::SAML2::SP->new(
issuer => 'http://localhost:3000',
url => 'http://localhost:3000',
cert => 'sign-nopw-cert.pem',
key => 'sign-nopw-key.pem', );
iconic. she's born. moving on. β¨
π¦ METHODS π¦
new( ... )
The constructor, bestie β this is the glow-up moment where your SP object comes into existence. π
Here's every argument she takes, and I mean every one, because we do not skip details in this house:
idβ the ID attribute that gets used in theEntityDescriptiontag. that's her government name fr.urlβ the base for all of the SP's service URLs. everything else is relative to this queen. πerror_urlβ the error URI. lowkey flexible: it can be relative to the base URI or a full-on regular URI.issuerβ the SP's identity URI. this is who she says she is in the group chat.certβ path to the signing certificate.keyβ path to the private key for that signing certificate.encryption_keyβ path to the public key that the IdP should use for encryption. this one only really shows up when you're generating the metadata.signing_onlyβ tells everyone that the signing key is used exclusively for signing, and not for both signing and encryption. no multitasking. πcacertβ path to the CA certificate for verification.langβ sets the language for themd:localizedNameType. defaults to"en". πorg_nameβ the SP organisation name.org_display_nameβ the SP organisation display name.org_contactβ the SP contact email address.org_urlβ the SP organisation url. this one's optional! if you don't provide it,urlgets used, exactly like in previous versions. π«Άauthnreq_signedβ specifies in the metadata whether the SP signs the AuthnRequest. optional (0or1), and it defaults to1(TRUE) if you don't specify it.want_assertions_signedβ specifies in the metadata whether the SP wants the Assertion from the IdP to be signed. optional (0or1), defaults to1(TRUE) if not specified.sign_metadataβ sign the metadata. defaults to1(TRUE) if not specified.single_logout_serviceβ okay so heads up, this option replaces the previousslo_url_post,slo_url_soapandslo_url_redirectconstructor parameters β those former options get mapped onto this new structure. it expects an array of hash refs where you define one or more Single Logout Services:
[
{
Binding => BINDING_HTTP_POST,
Location => https://foo.example.com/your-post-endpoint,
},
{
Binding => BINDING_HTTP_ARTIFACT,
Location => https://foo.example.com/your-artifact-endpoint,
}
]
assertion_consumer_serviceβ and this one replaces the previousacs_url_postandacs_url_artifactconstructor parameters; the former options get mapped onto this new structure. it expects an array of hash refs where you define one or more Assertion Consumer Services:
[
# Order decides the index if not supplied, else we assume you have an index
{
Binding => BINDING_HTTP_POST,
Location => https://foo.example.com/your-post-endpoint,
isDefault => 'false',
# optionally
index => 1,
},
{
Binding => BINDING_HTTP_ARTIFACT,
Location => https://foo.example.com/your-artifact-endpoint,
isDefault => 'true',
index => 2,
}
]
authn_request( $destination, $nameid_format, %params )
returns an AuthnRequest object, created by this SP, meant for the given destination β and that destination should be the identity URI of the IdP. π¦
%params is a hash of parameters that are valid for Net::SAML2::Protocol::AuthnRequest. like, for example:
my %params = (
force_authn => 1,
is_passive => 1,
)
my $authnreq = authn_request(
'https://keycloak.local:8443/realms/Foswiki/protocol/saml',
'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
%params
);
logout_request( $destination, $nameid, $nameid_format, $session, $params )
returns a LogoutRequest object made by this SP, aimed at the given destination, which β you guessed it β should be the identity URI of the IdP. π
it also needs the nameid (plus its format) and the session that's getting logged out.
$params is a HASH reference of parameters for Net::SAML2::Protocol::LogoutRequest:
$params = (
# name qualifier parameters from Assertion NameId
name_qualifier =>
"https://idp.shibboleth.local/idp/shibboleth"
sp_name_qualifier =>
"https://netsaml2-testapp.local"
);
logout_response( $destination, $status, $in_response_to )
returns a LogoutResponse object created by this SP, for the given destination, which should be the IdP's identity URI. πΈ
it also needs the status and the ID of the corresponding LogoutRequest. yes, the corresponding one. pair them up, bestie.
artifact_request( $destination, $artifact )
returns an ArtifactResolve request object created by this SP, intended for the given destination, which should be the identity URI of the IdP. π
sp_post_binding ( $idp, $param )
returns a POST binding object for this SP, configured against the given IDP, for Single Sign On. $param is the name of the query parameter involved β typically "SAMLRequest". π
sso_redirect_binding( $idp, $param )
returns a Redirect binding object for this SP, configured against the given IDP, for Single Sign On. $param names the query parameter involved β typically "SAMLRequest". β¨
slo_redirect_binding( $idp, $param )
returns a Redirect binding object for this SP, configured against the given IDP, for Single Log Out. $param names the query parameter involved β typically "SAMLRequest" or "SAMLResponse". π
soap_binding( $ua, $idp_url, $idp_cert )
returns a SOAP binding object for this SP, with a destination of the given URL and signing certificate. π§Ό
XXX UAβ yeah, that's literally what the docs say. the$uasituation is a whole TODO. not me pointing it out, the manpage did it first. π
post_binding( )
returns a POST binding object for this SP. that's it. that's the tweet. π«Ά
generate_metadata( )
generates the metadata XML document for this SP. π₯
key_name($type)
gets the key name for either the "signing" or the "encryption" key. pick your fighter. π
metadata( )
returns the metadata XML document for this SP. (generated already, she's just handing it to you β¨)
get_default_assertion_service
returns the assertion service that's the default. the one in the front, the one with the index, the chosen one. π
π§ AUTHOR π§
Timothy Legge <timlegge@gmail.com> β thank him, he wrote this whole thing. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2026 by Venda Ltd, see the CONTRIBUTORS file for others.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, licensing. π
and that's the whole page, bestie β brought to you by perl v5.42.2, dated 2026-02-11, and by Net::SAML2::SP(3) herself. go sign something. π
πβ¨
π¦ where this page comes from
- alpine 3.24: perl-net-saml2-doc 0.85-r0 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms