idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
47,700
protected function readTrailer ( ) { try { $ trailerKeyword = $ this -> parser -> readValue ( null , PdfToken :: class ) ; if ( $ trailerKeyword -> value !== 'trailer' ) { throw new CrossReferenceException ( \ sprintf ( 'Unexpected end of cross reference. "trailer"-keyword expected, got: %s.' , $ trailerKeyword -> valu...
Read the trailer dictionary .
47,701
public function toXML ( DOMElement $ parent = null ) : DOMElement { if ( empty ( $ this -> entityID ) ) { throw new \ Exception ( 'Cannot convert EntityDescriptor to XML without an EntityID set.' ) ; } if ( $ parent === null ) { $ doc = DOMDocumentFactory :: create ( ) ; $ e = $ doc -> createElementNS ( Constants :: NS...
Create this EntityDescriptor .
47,702
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:AttributeConsumingService' ) ; $ parent -> appendChild ( $ e ) ; $ e -> setAttribute ( 'index' , strval ( $ this -> getIndex ( ) ) ) ; if ( $ this -> getIsDefault ( ...
Convert to \ DOMElement .
47,703
public static function extractPublicKeys ( CertificateProvider $ config , string $ usage = null , bool $ required = false ) : KeyCollection { $ keyLoader = new self ( ) ; return $ keyLoader -> loadKeysFromConfiguration ( $ config , $ usage , $ required ) ; }
Extracts the public keys given by the configuration . Mainly exists for BC purposes . Prioritisation order is keys > certData > certificate
47,704
public function loadKeys ( $ configuredKeys , string $ usage = null ) : void { foreach ( $ configuredKeys as $ keyData ) { if ( isset ( $ keyData [ 'X509Certificate' ] ) ) { $ key = new X509 ( $ keyData ) ; } else { $ key = new Key ( $ keyData ) ; } if ( $ usage && ! $ key -> canBeUsedFor ( $ usage ) ) { continue ; } $...
Loads the keys given optionally excluding keys when a usage is given and they are not configured to be used with the usage given
47,705
public function loadCertificateData ( string $ certificateData ) : void { $ this -> loadedKeys -> add ( X509 :: createFromCertificateData ( $ certificateData ) ) ; }
Attempts to load a key based on the given certificateData
47,706
public function loadCertificateFile ( string $ certificateFile ) : void { $ certificate = File :: getFileContents ( $ certificateFile ) ; if ( ! Certificate :: hasValidStructure ( $ certificate ) ) { throw new InvalidCertificateStructureException ( sprintf ( 'Could not find PEM encoded certificate in "%s"' , $ certific...
Loads the certificate in the file given
47,707
public function toXML ( DOMElement $ parent = null ) : DOMElement { $ element = parent :: toXML ( $ parent ) ; if ( $ this -> Format !== null ) { $ element -> setAttribute ( 'Format' , $ this -> Format ) ; } if ( $ this -> SPProvidedID !== null ) { $ element -> setAttribute ( 'SPProvidedID' , $ this -> SPProvidedID ) ;...
Convert this NameIDType to XML .
47,708
public function addChildren ( $ child ) : void { Assert :: isInstanceOfAny ( $ child , [ EntityDescriptor :: class , EntitiesDescriptor :: class ] ) ; $ this -> children [ ] = $ child ; }
Add the value to the children property .
47,709
public function toXML ( DOMElement $ parent = null ) : DOMElement { if ( $ parent === null ) { $ doc = DOMDocumentFactory :: create ( ) ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:EntitiesDescriptor' ) ; $ doc -> appendChild ( $ e ) ; } else { $ e = $ parent -> ownerDocument -> createElementNS ( Constan...
Convert this EntitiesDescriptor to XML .
47,710
public static function addList ( DOMElement $ parent , array $ extensions ) : void { if ( empty ( $ extensions ) ) { return ; } $ extElement = $ parent -> ownerDocument -> createElementNS ( Constants :: NS_SAMLP , 'samlp:Extensions' ) ; $ parent -> appendChild ( $ extElement ) ; foreach ( $ extensions as $ ext ) { $ ex...
Add a list of Extensions to the given element .
47,711
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: same ( $ this -> getElement ( ) -> namespaceURI , Constants :: NS_SAML ) ; Assert :: same ( $ this -> getElement ( ) -> localName , "AttributeValue" ) ; return Utils :: copyElement ( $ this -> element , $ parent ) ; }
Append this attribute value to an element .
47,712
public function unserialize ( $ serialized ) : void { $ doc = DOMDocumentFactory :: fromString ( unserialize ( $ serialized ) ) ; $ this -> element = $ doc -> documentElement ; }
Un - serialize this AttributeValue .
47,713
private function parseSubject ( DOMElement $ xml ) : void { $ subject = Utils :: xpQuery ( $ xml , './saml_assertion:Subject' ) ; if ( empty ( $ subject ) ) { return ; } elseif ( count ( $ subject ) > 1 ) { throw new \ Exception ( 'More than one <saml:Subject> in <saml:Assertion>.' ) ; } $ subject = $ subject [ 0 ] ; $...
Parse subject in assertion .
47,714
private function parseConditions ( DOMElement $ xml ) : void { $ conditions = Utils :: xpQuery ( $ xml , './saml_assertion:Conditions' ) ; if ( empty ( $ conditions ) ) { return ; } elseif ( count ( $ conditions ) > 1 ) { throw new \ Exception ( 'More than one <saml:Conditions> in <saml:Assertion>.' ) ; } $ conditions ...
Parse conditions in assertion .
47,715
private function parseAuthnStatement ( DOMElement $ xml ) : void { $ authnStatements = Utils :: xpQuery ( $ xml , './saml_assertion:AuthnStatement' ) ; if ( empty ( $ authnStatements ) ) { $ this -> authnInstant = null ; return ; } elseif ( count ( $ authnStatements ) > 1 ) { throw new \ Exception ( 'More than one <sam...
Parse AuthnStatement in assertion .
47,716
private function parseAuthnContext ( DOMElement $ authnStatementEl ) : void { $ authnContexts = Utils :: xpQuery ( $ authnStatementEl , './saml_assertion:AuthnContext' ) ; if ( count ( $ authnContexts ) > 1 ) { throw new \ Exception ( 'More than one <saml:AuthnContext> in <saml:AuthnStatement>.' ) ; } elseif ( empty ( ...
Parse AuthnContext in AuthnStatement .
47,717
private function parseAttributes ( DOMElement $ xml ) : void { $ firstAttribute = true ; $ attributes = Utils :: xpQuery ( $ xml , './saml_assertion:AttributeStatement/saml_assertion:Attribute' ) ; foreach ( $ attributes as $ attribute ) { if ( ! $ attribute -> hasAttribute ( 'Name' ) ) { throw new \ Exception ( 'Missi...
Parse attribute statements in assertion .
47,718
private function parseSignature ( DOMElement $ xml ) : void { $ signatureMethod = Utils :: xpQuery ( $ xml , './ds:Signature/ds:SignedInfo/ds:SignatureMethod/@Algorithm' ) ; $ sig = Utils :: validateElement ( $ xml ) ; if ( $ sig !== false ) { $ this -> wasSignedAtConstruction = true ; $ this -> setCertificates ( $ sig...
Parse signature on assertion .
47,719
public function validate ( XMLSecurityKey $ key ) : bool { Assert :: same ( $ key -> type , XMLSecurityKey :: RSA_SHA256 ) ; if ( $ this -> signatureData === null ) { return false ; } Utils :: validateSignature ( $ this -> signatureData , $ key ) ; return true ; }
Validate this assertion against a public key .
47,720
public function encryptNameId ( XMLSecurityKey $ key ) : void { if ( $ this -> nameId === null ) { throw new \ Exception ( 'Cannot encrypt NameID, no NameID set.' ) ; } $ doc = DOMDocumentFactory :: create ( ) ; $ root = $ doc -> createElement ( 'root' ) ; $ doc -> appendChild ( $ root ) ; $ this -> nameId -> toXML ( $...
Encrypt the NameID in the Assertion .
47,721
public function decryptNameId ( XMLSecurityKey $ key , array $ blacklist = [ ] ) : void { if ( $ this -> encryptedNameId === null ) { return ; } $ nameId = Utils :: decryptElement ( $ this -> encryptedNameId , $ key , $ blacklist ) ; Utils :: getContainer ( ) -> debugMessage ( $ nameId , 'decrypt' ) ; $ this -> nameId ...
Decrypt the NameId of the subject in the assertion .
47,722
public function decryptAttributes ( XMLSecurityKey $ key , array $ blacklist = [ ] ) : void { if ( ! $ this -> hasEncryptedAttributes ( ) ) { return ; } $ firstAttribute = true ; $ attributes = $ this -> getEncryptedAttributes ( ) ; foreach ( $ attributes as $ attributeEnc ) { $ attribute = Utils :: decryptElement ( $ ...
Decrypt the assertion attributes .
47,723
public function setAuthnContextDecl ( Chunk $ authnContextDecl ) : void { if ( ! empty ( $ this -> authnContextDeclRef ) ) { throw new \ Exception ( 'AuthnContextDeclRef is already registered! May only have either a Decl or a DeclRef, not both!' ) ; } $ this -> authnContextDecl = $ authnContextDecl ; }
Set the authentication context declaration .
47,724
public function setAuthnContextDeclRef ( string $ authnContextDeclRef = null ) : void { if ( ! empty ( $ this -> authnContextDecl ) ) { throw new \ Exception ( 'AuthnContextDecl is already registered! May only have either a Decl or a DeclRef, not both!' ) ; } $ this -> authnContextDeclRef = $ authnContextDeclRef ; }
Set the authentication context declaration reference .
47,725
public function toXML ( \ DOMNode $ parentElement = null ) : DOMElement { if ( $ parentElement === null ) { $ document = DOMDocumentFactory :: create ( ) ; $ parentElement = $ document ; } else { $ document = $ parentElement -> ownerDocument ; } $ root = $ document -> createElementNS ( Constants :: NS_SAML , 'saml:' . ...
Convert this assertion to an XML element .
47,726
private function addConditions ( DOMElement $ root ) : void { $ document = $ root -> ownerDocument ; $ conditions = $ document -> createElementNS ( Constants :: NS_SAML , 'saml:Conditions' ) ; $ root -> appendChild ( $ conditions ) ; if ( $ this -> notBefore !== null ) { $ conditions -> setAttribute ( 'NotBefore' , gmd...
Add a Conditions - node to the assertion .
47,727
private function addAuthnStatement ( DOMElement $ root ) : void { if ( $ this -> authnInstant === null || ( $ this -> authnContextClassRef === null && $ this -> authnContextDecl === null && $ this -> authnContextDeclRef === null ) ) { return ; } $ document = $ root -> ownerDocument ; $ authnStatementEl = $ document -> ...
Add a AuthnStatement - node to the assertion .
47,728
private function addEncryptedAttributeStatement ( DOMElement $ root ) : void { if ( $ this -> getRequiredEncAttributes ( ) === false ) { return ; } Assert :: notNull ( $ this -> encryptionKey ) ; $ document = $ root -> ownerDocument ; $ attributeStatement = $ document -> createElementNS ( Constants :: NS_SAML , 'saml:A...
Add an EncryptedAttribute Statement - node to the assertion .
47,729
public function setAssertionConsumerServiceURL ( string $ assertionConsumerServiceURL ) : void { if ( ! filter_var ( $ assertionConsumerServiceURL , FILTER_VALIDATE_URL ) ) { throw new InvalidArgumentException ( 'AssertionConsumerServiceURL is not a valid URL.' ) ; } $ this -> AssertionConsumerServiceURL = $ assertionC...
Set the value of the AssertionConsumerServiceURL - property
47,730
public function toXML ( DOMElement $ parent ) : DOMElement { if ( ! is_string ( $ this -> getAssertionConsumerServiceURL ( ) ) ) { throw new InvalidArgumentException ( "AssertionConsumerServiceURL must be a string" ) ; } $ doc = $ parent -> ownerDocument ; $ response = $ doc -> createElementNS ( Constants :: NS_ECP , '...
Convert this ECP Response to XML .
47,731
public function setUrl ( string $ url ) : void { if ( ! filter_var ( trim ( $ url ) , FILTER_VALIDATE_URL ) && substr ( trim ( $ url ) , 0 , 5 ) !== 'data:' ) { throw new \ InvalidArgumentException ( 'mdui:Logo is not a valid URL.' ) ; } $ this -> url = $ url ; }
Set the value of the url - property
47,732
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Common :: NS , 'mdui:Logo' ) ; $ e -> appendChild ( $ doc -> createTextNode ( $ this -> url ) ) ; $ e -> setAttribute ( 'width' , strval ( $ this -> width ) ) ; $ e -> setAttribute ( 'height...
Convert this Logo to XML .
47,733
private static function getStringElements ( \ DOMElement $ parent , string $ name ) : array { $ e = Utils :: xpQuery ( $ parent , './saml_metadata:' . $ name ) ; $ ret = [ ] ; foreach ( $ e as $ i ) { $ ret [ ] = $ i -> textContent ; } return $ ret ; }
Retrieve the value of a child \ DOMElements as an array of strings .
47,734
private static function getStringElement ( \ DOMElement $ parent , string $ name ) : ? string { $ e = self :: getStringElements ( $ parent , $ name ) ; if ( empty ( $ e ) ) { return null ; } if ( count ( $ e ) > 1 ) { throw new \ Exception ( 'More than one ' . $ name . ' in ' . $ parent -> tagName ) ; } return $ e [ 0 ...
Retrieve the value of a child \ DOMElement as a string .
47,735
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:ContactPerson' ) ; $ parent -> appendChild ( $ e ) ; $ e -> setAttribute ( 'contactType' , $ this -> getContactType ( ) ) ; foreach ( $ this -> getContactPersonAttri...
Convert this ContactPerson to XML .
47,736
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: notEmpty ( $ this -> AuthzService ) ; $ e = parent :: toXML ( $ parent ) ; foreach ( $ this -> AuthzService as $ ep ) { $ ep -> toXML ( $ e , 'md:AuthzService' ) ; } foreach ( $ this -> AssertionIDRequestService as $ ep ) { $ ep -> toXML ( $ e , 'md...
Add this PDPDescriptor to an EntityDescriptor .
47,737
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: notEmpty ( $ this -> OrganizationName ) ; Assert :: notEmpty ( $ this -> OrganizationDisplayName ) ; Assert :: notEmpty ( $ this -> OrganizationURL ) ; $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:Org...
Convert this Organization to XML .
47,738
public function toXML ( DOMElement $ parent ) : DOMElement { if ( $ this -> KeyInfo === null ) { throw new \ Exception ( 'Cannot convert KeyDescriptor to XML without KeyInfo set.' ) ; } $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Constants :: NS_MD , 'md:KeyDescriptor' ) ; $ parent -> appendChi...
Convert this KeyDescriptor to XML .
47,739
public function send ( Message $ message ) : void { header ( 'Content-Type: text/xml' , true ) ; $ xml = $ this -> getOutputToSend ( $ message ) ; if ( $ xml !== false ) { Utils :: getContainer ( ) -> debugMessage ( $ xml , 'out' ) ; echo $ xml ; } exit ( 0 ) ; }
Send a SAML 2 message using the SOAP binding .
47,740
public function toXML ( DOMElement $ parent ) : DOMElement { $ e = $ this -> toXMLInternal ( $ parent , Constants :: NS_MD , 'md:RequestedAttribute' ) ; if ( is_bool ( $ this -> isRequired ) ) { $ e -> setAttribute ( 'isRequired' , $ this -> isRequired ? 'true' : 'false' ) ; } return $ e ; }
Convert this RequestedAttribute to XML .
47,741
public function toXML ( DOMElement $ parent ) : DOMElement { $ e = parent :: toXML ( $ parent ) ; if ( is_bool ( $ this -> WantAuthnRequestsSigned ) ) { $ e -> setAttribute ( 'WantAuthnRequestsSigned' , $ this -> WantAuthnRequestsSigned ? 'true' : 'false' ) ; } foreach ( $ this -> SingleSignOnService as $ ep ) { $ ep -...
Add this IDPSSODescriptor to an EntityDescriptor .
47,742
public function decryptAssertions ( ArrayCollection $ assertions ) { $ decrypted = new ArrayCollection ( ) ; foreach ( $ assertions -> getIterator ( ) as $ assertion ) { $ decrypted -> add ( $ this -> decryptAssertion ( $ assertion ) ) ; } return $ decrypted ; }
Decrypt assertions or do nothing if assertions are already decrypted .
47,743
public function toXML ( DOMElement $ parent ) : ? DOMElement { if ( ! empty ( $ this -> IPHint ) || ! empty ( $ this -> DomainHint ) || ! empty ( $ this -> GeolocationHint ) || ! empty ( $ this -> children ) ) { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Common :: NS , 'mdui:DiscoHints' ) ; $ ...
Convert this DiscoHints to XML .
47,744
private function validateSignature ( DOMElement $ xml ) : void { try { $ signatureMethod = Utils :: xpQuery ( $ xml , './ds:Signature/ds:SignedInfo/ds:SignatureMethod/@Algorithm' ) ; if ( empty ( $ signatureMethod ) ) { throw new \ Exception ( 'No Algorithm specified in signature.' ) ; } $ sig = Utils :: validateElemen...
Validate the signature element of a SAML message and configure this object appropriately to perform the signature verification afterwards .
47,745
public function validate ( XMLSecurityKey $ key ) : bool { if ( count ( $ this -> validators ) === 0 ) { return false ; } $ exceptions = [ ] ; foreach ( $ this -> validators as $ validator ) { $ function = $ validator [ 'Function' ] ; $ data = $ validator [ 'Data' ] ; try { call_user_func ( $ function , $ data , $ key ...
Validate this message against a public key .
47,746
public function toUnsignedXML ( ) : DOMElement { $ this -> document = DOMDocumentFactory :: create ( ) ; $ root = $ this -> document -> createElementNS ( Constants :: NS_SAMLP , 'samlp:' . $ this -> tagName ) ; $ this -> document -> appendChild ( $ root ) ; $ root -> setAttributeNS ( Constants :: NS_SAML , 'saml:tmp' ,...
Convert this message to an unsigned XML document . This method does not sign the resulting XML document .
47,747
public function toSignedXML ( ) : DOMElement { $ root = $ this -> toUnsignedXML ( ) ; if ( $ this -> signatureKey === null ) { return $ root ; } if ( $ this -> issuer !== null ) { $ issuerNode = $ root -> firstChild ; $ insertBefore = $ issuerNode -> nextSibling ; } else { $ insertBefore = $ root -> firstChild ; } Util...
Convert this message to a signed XML document . This method sign the resulting XML document if the private key for the signature is set .
47,748
public static function fromXML ( \ DOMElement $ xml ) : Message { if ( $ xml -> namespaceURI !== Constants :: NS_SAMLP ) { throw new \ Exception ( 'Unknown namespace of SAML message: ' . var_export ( $ xml -> namespaceURI , true ) ) ; } switch ( $ xml -> localName ) { case 'AttributeQuery' : return new AttributeQuery (...
Convert an XML element into a message .
47,749
public function unserialize ( $ serialized ) : void { $ doc = DOMDocumentFactory :: fromString ( unserialize ( $ serialized ) ) ; $ this -> xml = $ doc -> documentElement ; $ this -> setLocalName ( $ this -> xml -> localName ) ; $ this -> setNamespaceURI ( $ this -> xml -> namespaceURI ) ; }
Un - serialize this XML chunk .
47,750
public function send ( Message $ message ) : void { $ destination = $ this -> getRedirectURL ( $ message ) ; Utils :: getContainer ( ) -> redirect ( $ destination ) ; }
Send a SAML 2 message using the HTTP - Redirect binding .
47,751
public function receive ( ) : ? Message { if ( array_key_exists ( 'SAMLart' , $ _REQUEST ) ) { $ artifact = base64_decode ( $ _REQUEST [ 'SAMLart' ] ) ; $ endpointIndex = bin2hex ( substr ( $ artifact , 2 , 2 ) ) ; $ sourceId = bin2hex ( substr ( $ artifact , 4 , 20 ) ) ; } else { throw new \ Exception ( 'Missing SAMLa...
Receive a SAML 2 message sent using the HTTP - Artifact binding .
47,752
public function send ( Message $ message ) : void { if ( $ this -> destination === null ) { $ destination = $ message -> getDestination ( ) ; if ( $ destination === null ) { throw new \ Exception ( 'Cannot send message, no destination set.' ) ; } } else { $ destination = $ this -> destination ; } $ relayState = $ messa...
Send a SAML 2 message using the HTTP - POST binding .
47,753
public function isSuccess ( ) : bool { Assert :: keyExists ( $ this -> status , "Code" ) ; return $ this -> status [ 'Code' ] === Constants :: STATUS_SUCCESS ; }
Determine whether this is a successful response .
47,754
public function toUnsignedXML ( ) : DOMElement { $ root = parent :: toUnsignedXML ( ) ; if ( $ this -> inResponseTo !== null ) { $ root -> setAttribute ( 'InResponseTo' , $ this -> inResponseTo ) ; } $ status = $ this -> document -> createElementNS ( Constants :: NS_SAMLP , 'Status' ) ; $ root -> appendChild ( $ status...
Convert status response message to an XML element .
47,755
protected function toXMLInternal ( DOMElement $ parent , string $ namespace , string $ name ) : DOMElement { $ e = $ parent -> ownerDocument -> createElementNS ( $ namespace , $ name ) ; $ parent -> appendChild ( $ e ) ; if ( empty ( $ this -> Name ) ) { throw new \ Exception ( 'Cannot convert Attribute to XML with no ...
Internal implementation of toXML . This function allows RequestedAttribute to specify the element name and namespace .
47,756
public function loadPrivateKey ( PrivateKeyConfiguration $ key ) : PrivateKey { if ( $ key -> isFile ( ) ) { $ privateKey = File :: getFileContents ( $ key -> getFilePath ( ) ) ; } else { $ privateKey = $ key -> getContents ( ) ; } return PrivateKey :: create ( $ privateKey , $ key -> getPassPhrase ( ) ) ; }
Loads a private key based on the configuration given .
47,757
public function toXML ( DOMElement $ parent ) : DOMElement { $ e = Utils :: addString ( $ parent , Constants :: NS_MD , 'md:AdditionalMetadataLocation' , $ this -> getLocation ( ) ) ; $ e -> setAttribute ( 'namespace' , $ this -> getNamespace ( ) ) ; return $ e ; }
Convert this AdditionalMetadataLocation to XML .
47,758
public function setAddress ( string $ address = null ) : void { if ( ! is_null ( $ address ) && ! filter_var ( $ address , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 ) ) { Utils :: getContainer ( ) -> getLogger ( ) -> warning ( sprintf ( 'Provided argument (%s) is not a valid IP address.' , $ address ) ) ...
Set the value of the Address - property
47,759
public function addChildren ( $ child ) : void { Assert :: isInstanceOfAny ( $ child , [ Chunk :: class , Attribute :: class ] ) ; $ this -> children [ ] = $ child ; }
Add the value to the children - property
47,760
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( EntityAttributes :: NS , 'mdattr:EntityAttributes' ) ; $ parent -> appendChild ( $ e ) ; foreach ( $ this -> children as $ child ) { $ child -> toXML ( $ e ) ; } return $ e ; }
Convert this EntityAttributes to XML .
47,761
public function canBeUsedFor ( string $ usage ) : bool { if ( ! in_array ( $ usage , static :: getValidKeyUsages ( ) , true ) ) { throw new InvalidKeyUsageException ( $ usage ) ; } return isset ( $ this -> keyData [ $ usage ] ) && $ this -> keyData [ $ usage ] ; }
Whether or not the key is configured to be used for usage given
47,762
public function add ( $ key ) : void { Assert :: isInstanceOf ( $ key , Key :: class ) ; parent :: add ( $ key ) ; }
Add a key to the collection
47,763
protected function validateElementWithKeys ( SignedElement $ element , \ SAML2 \ Utilities \ ArrayCollection $ pemCandidates ) : bool { $ lastException = null ; foreach ( $ pemCandidates as $ index => $ candidateKey ) { $ key = new XMLSecurityKey ( XMLSecurityKey :: RSA_SHA256 , [ 'type' => 'public' ] ) ; $ key -> load...
BC compatible version of the signature check
47,764
private function enforcePreconditions ( Response $ response ) : void { $ result = $ this -> preconditionValidator -> validate ( $ response ) ; if ( ! $ result -> isValid ( ) ) { throw PreconditionNotMetException :: createFromValidationResult ( $ result ) ; } }
Checks the preconditions that must be valid in order for the response to be processed .
47,765
private function parseSubject ( \ DOMElement $ xml ) : void { $ subject = Utils :: xpQuery ( $ xml , './saml_assertion:Subject' ) ; if ( empty ( $ subject ) ) { throw new \ Exception ( 'Missing subject in subject query.' ) ; } elseif ( count ( $ subject ) > 1 ) { throw new \ Exception ( 'More than one <saml:Subject> in...
Parse subject in query .
47,766
public function toUnsignedXML ( ) : DOMElement { if ( $ this -> nameId === null ) { throw new \ Exception ( 'Cannot convert SubjectQuery to XML without a NameID set.' ) ; } $ root = parent :: toUnsignedXML ( ) ; $ subject = $ root -> ownerDocument -> createElementNS ( Constants :: NS_SAML , 'saml:Subject' ) ; $ root ->...
Convert subject query message to an XML element .
47,767
public function toXML ( DOMElement $ parent ) : DOMElement { $ e = parent :: toXML ( $ parent ) ; if ( is_bool ( $ this -> AuthnRequestsSigned ) ) { $ e -> setAttribute ( 'AuthnRequestsSigned' , $ this -> AuthnRequestsSigned ? 'true' : 'false' ) ; } if ( is_bool ( $ this -> WantAssertionsSigned ) ) { $ e -> setAttribut...
Add this SPSSODescriptor to an EntityDescriptor .
47,768
public function toUnsignedXML ( ) : DOMElement { $ root = parent :: toUnsignedXML ( ) ; foreach ( $ this -> attributes as $ name => $ values ) { $ attribute = $ root -> ownerDocument -> createElementNS ( Constants :: NS_SAML , 'saml:Attribute' ) ; $ root -> appendChild ( $ attribute ) ; $ attribute -> setAttribute ( 'N...
Convert the attribute query message to an XML element .
47,769
public function setSessionIndex ( string $ sessionIndex = null ) : void { if ( is_null ( $ sessionIndex ) ) { $ this -> sessionIndexes = [ ] ; } else { $ this -> sessionIndexes = [ $ sessionIndex ] ; } }
Set the sesion index of the session that should be terminated .
47,770
public function toUnsignedXML ( ) : DOMElement { if ( $ this -> encryptedNameId === null && $ this -> nameId === null ) { throw new \ Exception ( 'Cannot convert LogoutRequest to XML without a NameID set.' ) ; } $ root = parent :: toUnsignedXML ( ) ; if ( $ this -> notOnOrAfter !== null ) { $ root -> setAttribute ( 'No...
Convert this logout request message to an XML element .
47,771
public function receive ( ) : ? Message { $ data = self :: parseQuery ( ) ; if ( array_key_exists ( 'SAMLRequest' , $ data ) ) { $ message = $ data [ 'SAMLRequest' ] ; } elseif ( array_key_exists ( 'SAMLResponse' , $ data ) ) { $ message = $ data [ 'SAMLResponse' ] ; } else { throw new \ Exception ( 'Missing SAMLReques...
Receive a SAML 2 message sent using the HTTP - Redirect binding .
47,772
private static function parseQuery ( ) : array { $ data = [ ] ; $ relayState = '' ; $ sigAlg = '' ; $ sigQuery = '' ; foreach ( explode ( '&' , $ _SERVER [ 'QUERY_STRING' ] ) as $ e ) { $ tmp = explode ( '=' , $ e , 2 ) ; $ name = $ tmp [ 0 ] ; if ( count ( $ tmp ) === 2 ) { $ value = $ tmp [ 1 ] ; } else { $ value = '...
Helper function to parse query data .
47,773
public static function validateSignature ( array $ data , XMLSecurityKey $ key ) : void { Assert :: keyExists ( $ data , "Query" ) ; Assert :: keyExists ( $ data , "SigAlg" ) ; Assert :: keyExists ( $ data , "Signature" ) ; $ query = $ data [ 'Query' ] ; $ sigAlg = $ data [ 'SigAlg' ] ; $ signature = $ data [ 'Signatur...
Validate the signature on a HTTP - Redirect message .
47,774
protected function toXML ( DOMElement $ parent ) : DOMElement { $ e = parent :: toXML ( $ parent ) ; foreach ( $ this -> ArtifactResolutionService as $ ep ) { $ ep -> toXML ( $ e , 'md:ArtifactResolutionService' ) ; } foreach ( $ this -> SingleLogoutService as $ ep ) { $ ep -> toXML ( $ e , 'md:SingleLogoutService' ) ;...
Add this SSODescriptorType to an EntityDescriptor .
47,775
public function addData ( $ data ) : void { Assert :: isInstanceOfAny ( $ data , [ Chunk :: class , X509Certificate :: class ] ) ; $ this -> data [ ] = $ data ; }
Add the value to the data - property
47,776
public function toXML ( DOMElement $ parent ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( XMLSecurityDSig :: XMLDSIGNS , 'ds:X509Data' ) ; $ parent -> appendChild ( $ e ) ; foreach ( $ this -> getData ( ) as $ n ) { $ n -> toXML ( $ e ) ; } return $ e ; }
Convert this X509Data element to XML .
47,777
public function toXML ( DOMElement $ parent ) : DOMElement { return Utils :: addString ( $ parent , XMLSecurityDSig :: XMLDSIGNS , 'ds:X509Certificate' , $ this -> getCertificate ( ) ) ; }
Convert this X509Certificate element to XML .
47,778
public static function getBinding ( string $ urn ) : Binding { switch ( $ urn ) { case Constants :: BINDING_HTTP_POST : return new HTTPPost ( ) ; case Constants :: BINDING_HTTP_REDIRECT : return new HTTPRedirect ( ) ; case Constants :: BINDING_HTTP_ARTIFACT : return new HTTPArtifact ( ) ; case Constants :: BINDING_HOK_...
Retrieve a binding with the given URN .
47,779
public static function getCurrentBinding ( ) : Binding { switch ( $ _SERVER [ 'REQUEST_METHOD' ] ) { case 'GET' : if ( array_key_exists ( 'SAMLRequest' , $ _GET ) || array_key_exists ( 'SAMLResponse' , $ _GET ) ) { return new HTTPRedirect ( ) ; } elseif ( array_key_exists ( 'SAMLart' , $ _GET ) ) { return new HTTPArtif...
Guess the current binding .
47,780
public function hasAttributeNS ( string $ namespaceURI , string $ localName ) : bool { $ fullName = '{' . $ namespaceURI . '}' . $ localName ; return isset ( $ this -> attributes [ $ fullName ] ) ; }
Check if a namespace - qualified attribute exists .
47,781
public function removeAttributeNS ( string $ namespaceURI , string $ localName ) : void { $ fullName = '{' . $ namespaceURI . '}' . $ localName ; unset ( $ this -> attributes [ $ fullName ] ) ; }
Remove a namespace - qualified attribute .
47,782
public function toXML ( DOMElement $ parent = null ) : DOMElement { if ( ( $ this -> Saml2IssuerShowAll && ( $ this -> Format === Constants :: NAMEID_ENTITY ) ) || ( $ this -> Format !== Constants :: NAMEID_ENTITY ) ) { return parent :: toXML ( $ parent ) ; } if ( $ parent === null ) { $ parent = DOMDocumentFactory :: ...
Convert this Issuer to XML .
47,783
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: notEmpty ( $ this -> AttributeService ) ; $ e = parent :: toXML ( $ parent ) ; foreach ( $ this -> AttributeService as $ ep ) { $ ep -> toXML ( $ e , 'md:AttributeService' ) ; } foreach ( $ this -> AssertionIDRequestService as $ ep ) { $ ep -> toXML...
Add this AttributeAuthorityDescriptor to an EntityDescriptor .
47,784
public static function validateElement ( DOMElement $ root ) { $ objXMLSecDSig = new XMLSecurityDSig ( ) ; $ objXMLSecDSig -> idKeys [ ] = 'ID' ; $ signatureElement = self :: xpQuery ( $ root , './ds:Signature' ) ; if ( empty ( $ signatureElement ) ) { return false ; } elseif ( count ( $ signatureElement ) > 1 ) { thro...
Check the Signature in a XML element .
47,785
public static function castKey ( XMLSecurityKey $ key , string $ algorithm , string $ type = null ) : XMLSecurityKey { $ type = $ type ? : 'public' ; Assert :: oneOf ( $ type , [ "private" , "public" ] ) ; if ( $ key -> type === $ algorithm ) { return $ key ; } if ( ! in_array ( $ algorithm , [ XMLSecurityKey :: RSA_1_...
Helper function to convert a XMLSecurityKey to the correct algorithm .
47,786
public static function validateSignature ( array $ info , XMLSecurityKey $ key ) : void { Assert :: keyExists ( $ info , "Signature" ) ; $ objXMLSecDSig = $ info [ 'Signature' ] ; $ sigMethod = self :: xpQuery ( $ objXMLSecDSig -> sigNode , './ds:SignedInfo/ds:SignatureMethod' ) ; if ( empty ( $ sigMethod ) ) { throw n...
Check a signature against a key .
47,787
public static function xpQuery ( DOMNode $ node , string $ query ) : array { static $ xpCache = null ; if ( $ node instanceof DOMDocument ) { $ doc = $ node ; } else { $ doc = $ node -> ownerDocument ; } if ( $ xpCache === null || ! $ xpCache -> document -> isSameNode ( $ doc ) ) { $ xpCache = new DOMXPath ( $ doc ) ; ...
Do an XPath query on an XML node .
47,788
public static function copyElement ( DOMElement $ element , DOMElement $ parent = null ) : DOMElement { if ( $ parent === null ) { $ document = DOMDocumentFactory :: create ( ) ; } else { $ document = $ parent -> ownerDocument ; } $ namespaces = [ ] ; for ( $ e = $ element ; $ e instanceof DOMNode ; $ e = $ e -> parent...
Make an exact copy the specific \ DOMElement .
47,789
public static function parseBoolean ( DOMElement $ node , string $ attributeName , $ default = null ) { if ( ! $ node -> hasAttribute ( $ attributeName ) ) { return $ default ; } $ value = $ node -> getAttribute ( $ attributeName ) ; switch ( strtolower ( $ value ) ) { case '0' : case 'false' : return false ; case '1' ...
Parse a boolean attribute .
47,790
public static function insertSignature ( XMLSecurityKey $ key , array $ certificates , DOMElement $ root , DOMNode $ insertBefore = null ) : void { $ objXMLSecDSig = new XMLSecurityDSig ( ) ; $ objXMLSecDSig -> setCanonicalMethod ( XMLSecurityDSig :: EXC_C14N ) ; switch ( $ key -> type ) { case XMLSecurityKey :: RSA_SH...
Insert a Signature node .
47,791
public static function extractLocalizedStrings ( \ DOMElement $ parent , string $ namespaceURI , string $ localName ) : array { $ ret = [ ] ; foreach ( $ parent -> childNodes as $ node ) { if ( $ node -> namespaceURI !== $ namespaceURI || $ node -> localName !== $ localName ) { continue ; } else if ( ! ( $ node instanc...
Extract localized strings from a set of nodes .
47,792
public static function extractStrings ( DOMElement $ parent , string $ namespaceURI , string $ localName ) : array { $ ret = [ ] ; foreach ( $ parent -> childNodes as $ node ) { if ( $ node -> namespaceURI !== $ namespaceURI || $ node -> localName !== $ localName ) { continue ; } $ ret [ ] = trim ( $ node -> textConten...
Extract strings from a set of nodes .
47,793
public static function addString ( DOMElement $ parent , string $ namespace , string $ name , string $ value ) : DOMElement { $ doc = $ parent -> ownerDocument ; $ n = $ doc -> createElementNS ( $ namespace , $ name ) ; $ n -> appendChild ( $ doc -> createTextNode ( $ value ) ) ; $ parent -> appendChild ( $ n ) ; retur...
Append string element .
47,794
public static function addStrings ( DOMElement $ parent , string $ namespace , string $ name , bool $ localized , array $ values ) : void { $ doc = $ parent -> ownerDocument ; foreach ( $ values as $ index => $ value ) { $ n = $ doc -> createElementNS ( $ namespace , $ name ) ; $ n -> appendChild ( $ doc -> createTextN...
Append string elements .
47,795
public static function createKeyDescriptor ( string $ x509Data ) : KeyDescriptor { $ x509Certificate = new X509Certificate ( ) ; $ x509Certificate -> setCertificate ( $ x509Data ) ; $ x509Data = new X509Data ( ) ; $ x509Data -> addData ( $ x509Certificate ) ; $ keyInfo = new KeyInfo ( ) ; $ keyInfo -> addInfo ( $ x509D...
Create a KeyDescriptor with the given certificate .
47,796
public function toXML ( DOMElement $ parent ) : DOMElement { Assert :: notEmpty ( $ this -> lang , "Cannot convert Keywords to XML without a language set." ) ; $ doc = $ parent -> ownerDocument ; $ e = $ doc -> createElementNS ( Common :: NS , 'mdui:Keywords' ) ; $ e -> setAttribute ( 'xml:lang' , $ this -> lang ) ; $ ...
Convert this Keywords to XML .
47,797
public function toXML ( DOMElement $ parent ) : ? DOMElement { $ e = null ; if ( ! empty ( $ this -> DisplayName ) || ! empty ( $ this -> Description ) || ! empty ( $ this -> InformationURL ) || ! empty ( $ this -> PrivacyStatementURL ) || ! empty ( $ this -> Keywords ) || ! empty ( $ this -> Logo ) || ! empty ( $ this...
Convert this UIInfo to XML .
47,798
public function redirect ( string $ url , array $ data = [ ] ) : void { $ this -> redirectUrl = $ url ; $ this -> redirectData = $ data ; }
Trigger the user to perform a GET to the given URL with the given data .
47,799
public function postRedirect ( string $ url = null , array $ data = [ ] ) : void { $ this -> postRedirectUrl = $ url ; $ this -> postRedirectData = $ data ; }
Trigger the user to perform a POST to the given URL with the given data .