NAME

Mojo::SAML::IdP - A convenience module to extract information from an IdP entity descriptor document

SYNOPSIS

DESCRIPTION

Mojo::SAML::IdP is a convenience class for extracting information from IdP entity descriptor metadata. This module is especially fragile and will change as its usefulness is assessed and improved.

ATTRIBUTES

Mojo::SAML::IdP inherits all of the attributes from Mojo::Base and implements the following new ones.

entity_id

The entity id (entityID) of the entity to be inspected. If the "metdata" contains only one entity descriptor, it will default to that id. Otherwise, it must be specified manually otherwise it will throw an exception.

metadata

The metadata of the entity, as a Mojo::DOM object. Note that there are several methods which can be used to populate this values. Otherwise accessing it without it being set will throw an exception.

ua

An instance of Mojo::UserAgent used to fetch remote metadata.

METHODS

Mojo::SAML::IdP inherits all of the methods from Mojo::Base and implements the following new ones.

certificate_for

my $cert = $idp->certificate_for($use);

Returns a Crypt::OpenSSL::X509 instance for the "entity" and a given use.

default_id_format

my $format = $idp->default_id_format;

Returns the first nameid format.

entity

my $entity = $idp->entity;

Get the Mojo::DOM instance for the entity identified by the "entity_id". This is used by many other methods for picking the entity information.

from_file

my $idp = Mojo::SAML::IdP->new->from_file($path);

Load "metadata" from a given file. Return the instance, designed to chain with new.

from_url

my $idp = Mojo::SAML::IdP->new->from_url($url);

Load "metadata" from a given url using the "ua". Return the instance, designed to chain with new.

from_xml

my $idp = Mojo::SAML::IdP->new->from_xml($url);

Load "metadata" from a given string. Return the instance, designed to chain with new.

location_for

my $url = $idp->location_for($service, $binding);

Extract a Mojo::URL for the "entity"'s given service and binding. The binding may be shortend in a manner that can be fully qualified via "binding" in Mojo::SAML::Names.

name_id_format

$format = $idp->name_id_format($format);

Return the nameid format for the "entity" if the nameid format given is accepted. The format may be shortend in a manner that can be fully qualified via "nameid_format" in Mojo::SAML::Names.

public_key_for

my $pub = $idp->public_key_for($use);

A wrapper for "certificate_for" which returns a Crypt::OpenSSL::RSA public key instance for the certificate.

verify_signature

my $verified = $idp->verify_signature;
my $verified = $idp->verify_signature($pub);

Verify the metadata file's signature, either against itself or against a passed in public key. Returns undef if no signature is found or a boolean signifying verification.