PHP Class SAML2\Message

Implements what is common between the samlp:RequestAbstractType and samlp:StatusResponseType element types.
Inheritance: implements saml2\SignedElement
Afficher le fichier Open project: simplesamlphp/saml2 Class Usage Examples

Protected Properties

Свойство Type Description
$document DOMDocument This variable is used while generating XML from this message. It holds the \DOMDocument of the XML we are generating.
$extensions array Request extensions.
$messageContainedSignatureUponConstruction boolean

Méthodes publiques

Méthode Description
addValidator ( callback $function, mixed $data ) Add a method for validating this message.
fromXML ( DOMElement $xml ) : Message Convert an XML element into a message.
getCertificates ( ) : array Retrieve the certificates that are included in the message.
getConsent ( ) : string Set the given consent for this message.
getDestination ( ) : string | null Retrieve the destination of this message.
getExtensions ( ) : SAML2\XML\samlp\Extensions Retrieve the Extensions.
getId ( ) : string Retrieve the identifier of this message.
getIssueInstant ( ) : integer Retrieve the issue timestamp of this message.
getIssuer ( ) : string | Issuer | null Retrieve the issuer if this message.
getRelayState ( ) : string | null Retrieve the RelayState associated with this message.
getSignatureKey ( ) : XMLSecurityKey | null Retrieve the private key we should use to sign the message.
getSignatureMethod ( ) : null | string
isMessageConstructedWithSignature ( ) : boolean Query whether or not the message contained a signature at the root level when the object was constructed.
setCertificates ( array $certificates ) Set the certificates that should be included in the message.
setConsent ( string $consent ) Set the given consent for this message.
setDestination ( string | null $destination ) Set the destination of this message.
setExtensions ( array | null $extensions ) Set the Extensions.
setId ( string $id ) Set the identifier of this message.
setIssueInstant ( integer $issueInstant ) Set the issue timestamp of this message.
setIssuer ( string | Issuer | null $issuer ) Set the issuer of this message.
setRelayState ( string | null $relayState ) Set the RelayState associated with this message.
setSignatureKey ( XMLsecurityKey $signatureKey = null ) Set the private key we should use to sign the message.
toSignedXML ( ) : DOMElement Convert this message to a signed XML document.
toUnsignedXML ( ) : DOMElement Convert this message to an unsigned XML document.
validate ( XMLSecurityKey $key ) : boolean Validate this message against a public key.

Méthodes protégées

Méthode Description
__construct ( string $tagName, DOMElement $xml = null ) Initialize a message.

Private Methods

Méthode Description
validateSignature ( DOMElement $xml ) Validate the signature element of a SAML message, and configure this object appropriately to perform the signature verification afterwards.

Method Details

__construct() protected méthode

This constructor takes an optional parameter with a \DOMElement. If this parameter is given, the message will be initialized with data from that XML element. If no XML element is given, the message is initialized with suitable default values.
protected __construct ( string $tagName, DOMElement $xml = null )
$tagName string The tag name of the root element
$xml DOMElement The input message

addValidator() public méthode

This function is used by the HTTP-Redirect binding, to make it possible to check the signature against the one included in the query string.
public addValidator ( callback $function, mixed $data )
$function callback The function which should be called
$data mixed The data that should be included as the first parameter to the function

fromXML() public static méthode

Convert an XML element into a message.
public static fromXML ( DOMElement $xml ) : Message
$xml DOMElement The root XML element
Résultat Message The message

getCertificates() public méthode

Retrieve the certificates that are included in the message.
public getCertificates ( ) : array
Résultat array An array of certificates

getConsent() public méthode

Most likely (though not required) a value of rn:oasis:names:tc:SAML:2.0:consent.
See also: SAML2\Constants
public getConsent ( ) : string
Résultat string Consent

getDestination() public méthode

Retrieve the destination of this message.
public getDestination ( ) : string | null
Résultat string | null The destination of this message, or NULL if no destination is given

getExtensions() public méthode

Retrieve the Extensions.
public getExtensions ( ) : SAML2\XML\samlp\Extensions
Résultat SAML2\XML\samlp\Extensions

getId() public méthode

Retrieve the identifier of this message.
public getId ( ) : string
Résultat string The identifier of this message

getIssueInstant() public méthode

Retrieve the issue timestamp of this message.
public getIssueInstant ( ) : integer
Résultat integer The issue timestamp of this message, as an UNIX timestamp

getIssuer() public méthode

Retrieve the issuer if this message.
public getIssuer ( ) : string | Issuer | null
Résultat string | SAML2\XML\saml\Issuer | null The issuer of this message, or NULL if no issuer is given

getRelayState() public méthode

Retrieve the RelayState associated with this message.
public getRelayState ( ) : string | null
Résultat string | null The RelayState, or NULL if no RelayState is given

getSignatureKey() public méthode

Retrieve the private key we should use to sign the message.
public getSignatureKey ( ) : XMLSecurityKey | null
Résultat RobRichards\XMLSecLibs\XMLSecurityKey | null The key, or NULL if no key is specified

getSignatureMethod() public méthode

public getSignatureMethod ( ) : null | string
Résultat null | string

isMessageConstructedWithSignature() public méthode

Query whether or not the message contained a signature at the root level when the object was constructed.

setCertificates() public méthode

The certificates should be strings with the PEM encoded data.
public setCertificates ( array $certificates )
$certificates array An array of certificates

setConsent() public méthode

Most likely (though not required) a value of rn:oasis:names:tc:SAML:2.0:consent.
See also: SAML2\Constants
public setConsent ( string $consent )
$consent string

setDestination() public méthode

Set the destination of this message.
public setDestination ( string | null $destination )
$destination string | null The new destination of this message

setExtensions() public méthode

Set the Extensions.
public setExtensions ( array | null $extensions )
$extensions array | null The Extensions

setId() public méthode

Set the identifier of this message.
public setId ( string $id )
$id string The new identifier of this message

setIssueInstant() public méthode

Set the issue timestamp of this message.
public setIssueInstant ( integer $issueInstant )
$issueInstant integer The new issue timestamp of this message, as an UNIX timestamp

setIssuer() public méthode

Set the issuer of this message.
public setIssuer ( string | Issuer | null $issuer )
$issuer string | SAML2\XML\saml\Issuer | null The new issuer of this message

setRelayState() public méthode

Set the RelayState associated with this message.
public setRelayState ( string | null $relayState )
$relayState string | null The new RelayState

setSignatureKey() public méthode

If the key is null, the message will be sent unsigned.
public setSignatureKey ( XMLsecurityKey $signatureKey = null )
$signatureKey XMLsecurityKey

toSignedXML() public méthode

This method sign the resulting XML document if the private key for the signature is set.
public toSignedXML ( ) : DOMElement
Résultat DOMElement The root element of the DOM tree

toUnsignedXML() public méthode

This method does not sign the resulting XML document.
public toUnsignedXML ( ) : DOMElement
Résultat DOMElement The root element of the DOM tree

validate() public méthode

true is returned on success, false is returned if we don't have any signature we can validate. An exception is thrown if the signature validation fails.
public validate ( XMLSecurityKey $key ) : boolean
$key RobRichards\XMLSecLibs\XMLSecurityKey The key we should check against
Résultat boolean true on success, false when we don't have a signature

Property Details

$document protected_oe property

This variable is used while generating XML from this message. It holds the \DOMDocument of the XML we are generating.
protected DOMDocument $document
Résultat DOMDocument

$extensions protected_oe property

Request extensions.
protected array $extensions
Résultat array

$messageContainedSignatureUponConstruction protected_oe property

protected bool $messageContainedSignatureUponConstruction
Résultat boolean