This package provides a few helpful utilities on top of Light Saml to streamline common tasks.
composer require theodorejb/saml-utils
The SamlMetadata
class simplifies getting data from Identity Provider metadata.
Call SamlMetadata::fromXml($xml)
to create an instance from an Entity Descriptor XML string.
The underlying EntityDescriptor
object can be accessed via a readonly $entityDescriptor
property.
SamlMetadata
implements the following methods:
Returns an X509Certificate
instance for the Identity Provider certificate.
Returns the redirect location string defined by the Identity Provider for receiving a SAML request to initiate single sign-on.
Returns the redirect SingleLogoutService
if defined by the Identity Provider, otherwise null
.
The SamlUtils
class implements the following static utility methods:
Returns an object for the SAML request or response from the global GET/POST data.
Returns a Symfony\Component\HttpFoundation\Response
instance for sending the SAML message.
Throws an Exception if the message signature is missing or fails verification with the certificate.
Returns the user identity being asserted by the identity provider.
Returns the first assertion attribute statement if one exists.
Returns the assertion attribute value for the specified attribute name. Throws an exception if the attribute doesn't exist.
Same as getAttributeStatementValue()
, but can be used directly from
a SamlResponse
rather than an AttributeStatement
.