Net-SAML2
view release on metacpan or search on metacpan
lib/Net/SAML2/SP.pm view on Meta::CPAN
use Net::SAML2::Binding::POST;
use Net::SAML2::Binding::Redirect;
use Net::SAML2::Binding::SOAP;
use Net::SAML2::Protocol::AuthnRequest;
use Net::SAML2::Protocol::LogoutRequest;
use Net::SAML2::Util ();
use URN::OASIS::SAML2 qw(:bindings :urn);
use XML::Generator;
use Net::SAML2::Types qw(XsdID);
with 'Net::SAML2::Role::XMLLang';
# ABSTRACT: SAML Service Provider object
has 'url' => (isa => Uri, is => 'ro', required => 1, coerce => 1);
has '_id' => (
isa => XsdID,
is => 'ro',
builder => '_build_id',
init_arg => 'id'
);
has 'issuer' => (isa => 'Str', is => 'ro', required => 1);
has 'cert' => (isa => 'Str', is => 'ro', required => 1, predicate => 'has_cert');
has 'key' => (isa => 'Str', is => 'ro', required => 1);
has 'cacert' => (isa => 'Str', is => 'rw', required => 0, predicate => 'has_cacert');
has 'signing_only' => (isa => 'Bool', is => 'ro', required => 0);
has 'encryption_key' => (isa => 'Str', is => 'ro', required => 0, predicate => 'has_encryption_key');
has 'error_url' => (isa => Uri, is => 'ro', required => 1, coerce => 1);
has 'org_name' => (isa => 'Str', is => 'ro', required => 1);
has 'org_display_name' => (isa => 'Str', is => 'ro', required => 1);
has 'org_contact' => (isa => 'Str', is => 'ro', required => 1);
has 'org_url' => (isa => 'Str', is => 'ro', required => 0);
# These are no longer in use, but are not removed by the off change that
# someone that extended us or added a role to us with these params.
has 'slo_url_soap' => (isa => 'Str', is => 'ro', required => 0);
has 'slo_url_post' => (isa => 'Str', is => 'ro', required => 0);
has 'slo_url_redirect' => (isa => 'Str', is => 'ro', required => 0);
has 'acs_url_post' => (isa => 'Str', is => 'ro', required => 0);
has 'acs_url_artifact' => (isa => 'Str', is => 'ro', required => 0);
has 'attribute_consuming_service' =>
(isa => 'Net::SAML2::AttributeConsumingService', is => 'ro', predicate => 'has_attribute_consuming_service');
has '_cert_text' => (isa => 'Str', is => 'ro', init_arg => undef, builder => '_build_cert_text', lazy => 1);
has '_encryption_key_text' => (isa => 'Str', is => 'ro', init_arg => undef, builder => '_build_encryption_key_text', lazy => 1);
has 'authnreq_signed' => (isa => 'Bool', is => 'ro', required => 0, default => 1);
has 'want_assertions_signed' => (isa => 'Bool', is => 'ro', required => 0, default => 1);
has 'sign_metadata' => (isa => 'Bool', is => 'ro', required => 0, default => 1);
has assertion_consumer_service => (is => 'ro', isa => 'ArrayRef', required => 1);
has single_logout_service => (is => 'ro', isa => 'ArrayRef', required => 1);
around BUILDARGS => sub {
my $orig = shift;
my $self = shift;
my %args = @_;
if (!exists $args{issuer} && exists $args{id}) {
Net::SAML2::Util::deprecation_warning
"id has been renamed to issuer and should be used instead";
$args{issuer} = delete $args{id};
}
if (!$args{single_logout_service}) {
#warn "Deprecation warning, please upgrade your code to use ..";
my @slo;
if (my $slo = $args{slo_url_soap}) {
push(
@slo,
{
Binding => BINDING_SOAP,
Location => $args{url} . $slo,
}
);
}
if (my $slo = $args{slo_url_redirect}) {
push(
@slo,
{
Binding => BINDING_HTTP_REDIRECT,
Location => $args{url} . $slo,
}
);
}
if (my $slo = $args{slo_url_post}) {
push(
@slo,
{
Binding => BINDING_HTTP_POST,
Location => $args{url} . $slo,
}
);
}
$args{single_logout_service} = \@slo;
}
if (!$args{assertion_consumer_service}) {
#warn "Deprecation warning, please upgrade your code to use ..";
my @acs;
if (my $acs = delete $args{acs_url_post}) {
push(
@acs,
{
Binding => BINDING_HTTP_POST,
Location => $args{url} . $acs,
isDefault => 'true',
}
);
}
if (my $acs = $args{acs_url_artifact}) {
( run in 0.669 second using v1.01-cache-2.11-cpan-39bf76dae61 )