Utils of OneLogin PHP Toolkit
Defines several often used methods
t(string $msg, array $args = array()) : string
string
Message to be translated
array
Arguments
string
$translatedMsg Translated text
validateXML(string $xml, string $schema, boolean $debug = false) : string
It will parse the string into a DOM document and validate this document against the schema.
string
The XML string or document which should be validated.
string
The schema filename which should be used.
boolean
To disable/enable the debug mode
string
| DOMDocument $dom string that explains the problem or the DOMDocument
formatCert(string $cert, boolean $heads = true) : string
string
A x509 unformated cert
boolean
True if we want to include head and footer
string
$x509 Formated cert
formatPrivateKey(string $key, boolean $heads = true) : string
string
A private key
boolean
True if we want to include head and footer
string
$rsaKey Formated private key
redirect(string $url, array $parameters = array(), boolean $stay = false) : string
string
The target url
array
Extra parameters to be passed as part of the url
boolean
True if we want to stay (returns the url string) False to redirect
string
$url
getSelfURLhost() : string
string
$url
getSelfHost() : string
string
$currentHost The current host
isHTTPS() : boolean
boolean
$isHttps False if https is not active
getSelfURLNoQuery() : string
string
getSelfURL() : string
string
generateUniqueID() : string
string
A unique string
parseTime2SAML(string $time) : \$timestamp
string
The time we should convert (DateTime).
\$timestamp
SAML2 timestamp.
parseSAML2Time(string $time) : \$timestamp
string
The time we should convert (SAML Timestamp).
\$timestamp
Converted to a unix timestamp.
parseDuration(string $duration, int $timestamp = null) : int
string
The duration, as a string.
int
The unix timestamp we should apply the
duration to. Optional, default to the
current time.
int
The new timestamp, after the duration is applied.
getExpireTime(string $cacheDuration = null, string $validUntil = null) : int
string
The duration, as a string.
string
The valid until date, as a string or as a timestamp
int
$expireTime The expiration time.
query(\DOMDocument $dom, string $query, \DomElement $context = null) : \DOMNodeList
\DOMDocument
The DOMDocument
string
Xpath Expresion
\DomElement
Context Node (DomElement)
\DOMNodeList
The queried nodes
isSessionStarted() : boolean
boolean
true if the sessíon is started
deleteLocalSession()
calculateX509Fingerprint(string $x509cert) : string
string
x509 cert
string
Formated fingerprint
formatFingerPrint(string $fingerprint) : string
string
fingerprint
string
Formated fingerprint
generateNameId(string $value, string $spnq, string $format, string $key = null) : string
string
fingerprint
string
SP Name Qualifier
string
SP Format
string
SP Key to encrypt the nameID
string
$nameIDElement DOMElement | XMLSec nameID
getStatus(\DomElement $dom) : array
\DomElement
The Response as XML
array
$status The Status, an array with the code and a message.
decryptElement(\DOMElement $encryptedData, \XMLSecurityKey $inputKey) : \DOMElement
\DOMElement
The encrypted data.
\XMLSecurityKey
The decryption key.
\DOMElement
The decrypted element.
castKey(XMLSecurityKey $key, $algorithm, $type = 'public')
XMLSecurityKey
The key
string
The desired algorithm
string
Public or private key, defaults to public.
addSign(string|\DomDocument $xml, string $key, string $cert)
string|\DomDocument
The element we should sign
string
The private key
string
The public
validateSign(string|\DomDocument $xml, string|null $cert = null, string|null $fingerprint = null)
string|\DomDocument
The element we should validate
string|null
The pubic cert
string|null
The fingerprint of the public cert