idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
59,600
public function redrawControl ( $ snippet = NULL , $ redraw = TRUE ) { if ( $ redraw ) { $ this -> invalidSnippets [ $ snippet === NULL ? "\0" : $ snippet ] = TRUE ; } elseif ( $ snippet === NULL ) { $ this -> invalidSnippets = [ ] ; } else { $ this -> invalidSnippets [ $ snippet ] = FALSE ; } }
Forces control or its snippet to repaint .
59,601
public function isControlInvalid ( $ snippet = NULL ) { if ( $ snippet === NULL ) { if ( count ( $ this -> invalidSnippets ) > 0 ) { return TRUE ; } else { $ queue = [ $ this ] ; do { foreach ( array_shift ( $ queue ) -> getComponents ( ) as $ component ) { if ( $ component instanceof IRenderable ) { if ( $ component -...
Is required to repaint the control or its snippet?
59,602
function longToBinary ( $ long ) { $ cmp = $ this -> cmp ( $ long , 0 ) ; if ( $ cmp < 0 ) { $ msg = __FUNCTION__ . " takes only positive integers." ; trigger_error ( $ msg , E_USER_ERROR ) ; return null ; } if ( $ cmp == 0 ) { return "\x00" ; } $ bytes = array ( ) ; while ( $ this -> cmp ( $ long , 0 ) > 0 ) { array_u...
Given a long integer returns the number converted to a binary string . This function accepts long integer values of arbitrary magnitude and uses the local large - number math library when available .
59,603
function binaryToLong ( $ str ) { if ( $ str === null ) { return null ; } $ bytes = array_merge ( unpack ( 'C*' , $ str ) ) ; $ n = $ this -> init ( 0 ) ; if ( $ bytes && ( $ bytes [ 0 ] > 127 ) ) { trigger_error ( "bytesToNum works only for positive integers." , E_USER_WARNING ) ; return null ; } foreach ( $ bytes as ...
Given a binary string returns the binary string converted to a long number .
59,604
function _powmod ( $ base , $ exponent , $ modulus ) { $ square = $ this -> mod ( $ base , $ modulus ) ; $ result = 1 ; while ( $ this -> cmp ( $ exponent , 0 ) > 0 ) { if ( $ this -> mod ( $ exponent , 2 ) ) { $ result = $ this -> mod ( $ this -> mul ( $ result , $ square ) , $ modulus ) ; } $ square = $ this -> mod (...
Same as bcpowmod when bcpowmod is missing
59,605
static function getBytes ( $ num_bytes ) { static $ f = null ; if ( $ f === null ) { if ( Auth_OpenID_RAND_SOURCE === null ) { $ f = false ; } else { $ f = @ fopen ( Auth_OpenID_RAND_SOURCE , "r" ) ; if ( $ f === false ) { $ msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' . ' continue with an insecure random number ...
Get the specified number of random bytes .
59,606
function getExpiresIn ( $ now = null ) { if ( $ now == null ) { $ now = time ( ) ; } return max ( 0 , $ this -> issued + $ this -> lifetime - $ now ) ; }
This returns the number of seconds this association is still valid for or 0 if the association is no longer valid .
59,607
function serialize ( ) { $ data = array ( 'version' => '2' , 'handle' => $ this -> handle , 'secret' => base64_encode ( $ this -> secret ) , 'issued' => strval ( intval ( $ this -> issued ) ) , 'lifetime' => strval ( intval ( $ this -> lifetime ) ) , 'assoc_type' => $ this -> assoc_type ) ; assert ( array_keys ( $ data...
Convert an association to KV form .
59,608
function signMessage ( $ message ) { if ( $ message -> hasKey ( Auth_OpenID_OPENID_NS , 'sig' ) || $ message -> hasKey ( Auth_OpenID_OPENID_NS , 'signed' ) ) { return null ; } $ extant_handle = $ message -> getArg ( Auth_OpenID_OPENID_NS , 'assoc_handle' ) ; if ( $ extant_handle && ( $ extant_handle != $ this -> handle...
Generate a signature for some fields in a dictionary
59,609
function checkMessageSignature ( $ message ) { $ sig = $ message -> getArg ( Auth_OpenID_OPENID_NS , 'sig' ) ; if ( ! $ sig || Auth_OpenID :: isFailure ( $ sig ) ) { return false ; } $ calculated_sig = $ this -> getMessageSignature ( $ message ) ; return Auth_OpenID_CryptUtil :: constEq ( $ calculated_sig , $ sig ) ; }
Confirm that the signature of these fields matches the signature contained in the data .
59,610
function setAllowedTypes ( $ allowed_types ) { foreach ( $ allowed_types as $ pair ) { list ( $ assoc_type , $ session_type ) = $ pair ; if ( ! Auth_OpenID_checkSessionType ( $ assoc_type , $ session_type ) ) { return false ; } } $ this -> allowed_types = $ allowed_types ; return true ; }
Set the allowed association types checking to make sure each combination is valid .
59,611
function isAllowed ( $ assoc_type , $ session_type ) { $ assoc_good = in_array ( array ( $ assoc_type , $ session_type ) , $ this -> allowed_types ) ; $ matches = in_array ( $ session_type , Auth_OpenID_getSessionTypes ( $ assoc_type ) ) ; return ( $ assoc_good && $ matches ) ; }
Is this combination of association type and session type allowed?
59,612
function reset ( ) { $ this -> connection -> query ( sprintf ( "DELETE FROM %s" , $ this -> associations_table_name ) ) ; $ this -> connection -> query ( sprintf ( "DELETE FROM %s" , $ this -> nonces_table_name ) ) ; }
Resets the store by removing all records from the store s tables .
59,613
function _octify ( $ str ) { $ result = "" ; for ( $ i = 0 ; $ i < Auth_OpenID :: bytes ( $ str ) ; $ i ++ ) { $ ch = substr ( $ str , $ i , 1 ) ; if ( $ ch == "\\" ) { $ result .= "\\\\\\\\" ; } else if ( ord ( $ ch ) == 0 ) { $ result .= "\\\\000" ; } else { $ result .= "\\" . strval ( decoct ( ord ( $ ch ) ) ) ; } }...
Octifies a binary string by returning a string with escaped octal bytes . This is used for preparing binary data for PostgreSQL BYTEA fields .
59,614
function init ( $ xml_string , $ namespace_map ) { if ( ! $ this -> setXML ( $ xml_string ) ) { return false ; } foreach ( $ namespace_map as $ prefix => $ uri ) { if ( ! $ this -> registerNamespace ( $ prefix , $ uri ) ) { return false ; } } return true ; }
Initialize an instance of Auth_Yadis_XMLParser with some XML and namespaces . This SHOULD NOT be overridden by subclasses .
59,615
function createSamlAssertion ( $ authenticatedUser , $ notBefore , $ notOnOrAfter , $ rsadsa , $ acsURI , $ attribute , $ value , $ assertionTemplate ) { $ samlResponse = $ assertionTemplate ; $ samlResponse = str_replace ( 'USERNAME_STRING' , $ authenticatedUser , $ samlResponse ) ; $ samlResponse = str_replace ( 'RES...
Returns a SAML response with various elements filled in .
59,616
function signAssertion ( $ responseXmlString , $ privKey , $ cert ) { if ( file_exists ( "/tmp/xml" ) ) { $ tempFileDir = "/tmp/xml/" ; } else { mkdir ( "/tmp/xml" , 0777 ) ; $ tempFileDir = "/tmp/xml/" ; } $ tempName = 'saml-response-' . $ this -> samlCreateId ( ) . '.xml' ; $ tempFileName = $ tempFileDir . $ tempName...
Signs a SAML response with the given private key and embeds the public key .
59,617
function verifyAssertion ( $ responseXmlString , $ rootcert ) { date_default_timezone_set ( "UTC" ) ; if ( file_exists ( "/tmp/xml" ) ) { $ tempFileDir = "/tmp/xml/" ; } else { mkdir ( "/tmp/xml" , 0777 ) ; $ tempFileDir = "/tmp/xml/" ; } $ tempName = 'saml-response-' . $ this -> samlCreateId ( ) . '.xml' ; $ tempFileN...
Verify a saml response with the given public key .
59,618
function samlCreateId ( ) { $ rndChars = 'abcdefghijklmnop' ; $ rndId = '' ; for ( $ i = 0 ; $ i < 40 ; $ i ++ ) { $ rndId .= $ rndChars [ rand ( 0 , strlen ( $ rndChars ) - 1 ) ] ; } return $ rndId ; }
Creates a 40 - character string containing 160 - bits of pseudorandomness .
59,619
function validSamlDateFormat ( $ samlDate ) { if ( $ samlDate == "" ) return false ; $ indexT = strpos ( $ samlDate , 'T' ) ; $ indexZ = strpos ( $ samlDate , 'Z' ) ; if ( ( $ indexT != 10 ) || ( $ indexZ != 19 ) ) { return false ; } $ dateString = substr ( $ samlDate , 0 , 10 ) ; $ timeString = substr ( $ samlDate , $...
Attempts to check whether a SAML date is valid . Returns true or false .
59,620
function storeAssociation ( $ server_url , $ association ) { $ associationKey = $ this -> associationKey ( $ server_url , $ association -> handle ) ; $ serverKey = $ this -> associationServerKey ( $ server_url ) ; $ serverAssociations = $ this -> connection -> get ( $ serverKey ) ; if ( ! $ serverAssociations ) { $ ser...
Store association until its expiration time in memcached . Overwrites any existing association with same server_url and handle . Handles list of associations for every server .
59,621
function getAssociation ( $ server_url , $ handle = null ) { if ( $ handle !== null ) { $ association = $ this -> connection -> get ( $ this -> associationKey ( $ server_url , $ handle ) ) ; return $ association ? $ association : null ; } $ serverKey = $ this -> associationServerKey ( $ server_url ) ; $ serverAssociati...
Read association from memcached . If no handle given and multiple associations found returns latest issued
59,622
function removeAssociation ( $ server_url , $ handle ) { $ serverKey = $ this -> associationServerKey ( $ server_url ) ; $ associationKey = $ this -> associationKey ( $ server_url , $ handle ) ; $ serverAssociations = $ this -> connection -> get ( $ serverKey ) ; if ( ! $ serverAssociations ) { return false ; } $ serve...
Immediately delete association from memcache .
59,623
static function parse_str ( $ query ) { if ( $ query === null ) { return null ; } $ parts = explode ( '&' , $ query ) ; $ new_parts = array ( ) ; for ( $ i = 0 ; $ i < count ( $ parts ) ; $ i ++ ) { $ pair = explode ( '=' , $ parts [ $ i ] ) ; if ( count ( $ pair ) != 2 ) { continue ; } list ( $ key , $ value ) = $ pai...
Replacement for PHP s broken parse_str .
59,624
static function httpBuildQuery ( $ data ) { $ pairs = array ( ) ; foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ pairs [ ] = urlencode ( $ value [ 0 ] ) . "=" . urlencode ( $ value [ 1 ] ) ; } else { $ pairs [ ] = urlencode ( $ key ) . "=" . urlencode ( $ value ) ; } } return implode ( "&" , $...
Implements the PHP 5 http_build_query functionality .
59,625
static function urlunparse ( $ scheme , $ host , $ port = null , $ path = '/' , $ query = '' , $ fragment = '' ) { if ( ! $ scheme ) { $ scheme = 'http' ; } if ( ! $ host ) { return false ; } if ( ! $ path ) { $ path = '' ; } $ result = $ scheme . "://" . $ host ; if ( $ port ) { $ result .= ":" . $ port ; } $ result ....
Implements python s urlunparse which is not available in PHP . Given the specified components of a URL this function rebuilds and returns the URL .
59,626
static function fromDiscoveryResult ( $ discoveryResult ) { if ( $ discoveryResult -> isXRDS ( ) ) { return Auth_OpenID_ServiceEndpoint :: fromXRDS ( $ discoveryResult -> normalized_uri , $ discoveryResult -> response_text ) ; } else { return Auth_OpenID_ServiceEndpoint :: fromHTML ( $ discoveryResult -> normalized_uri...
Create endpoints from a DiscoveryResult .
59,627
function encodeToURL ( ) { if ( ! $ this -> message ) { return null ; } $ msg = $ this -> toMessage ( ) ; return $ msg -> toURL ( $ this -> getReturnTo ( ) ) ; }
Encodes this error s response as a URL suitable for redirection . If the response has no return_to another Auth_OpenID_ServerError is returned .
59,628
function whichEncoding ( ) { global $ _Auth_OpenID_Request_Modes ; if ( $ this -> hasReturnTo ( ) ) { if ( $ this -> message -> isOpenID2 ( ) && ( strlen ( $ this -> encodeToURL ( ) ) > Auth_OpenID_OPENID1_URL_LIMIT ) ) { return Auth_OpenID_ENCODE_HTML_FORM ; } else { return Auth_OpenID_ENCODE_URL ; } } if ( ! $ this -...
Returns one of Auth_OpenID_ENCODE_URL Auth_OpenID_ENCODE_KVFORM or null depending on the type of encoding expected for this error s payload .
59,629
function verify ( $ assoc_handle , $ message ) { $ assoc = $ this -> getAssociation ( $ assoc_handle , true ) ; if ( ! $ assoc ) { return false ; } return $ assoc -> checkMessageSignature ( $ message ) ; }
Verify using a given association handle a signature with signed key - value pairs from an HTTP request .
59,630
function sign ( $ response ) { $ signed_response = $ response ; $ request = $ response -> request ; $ assoc_handle = $ request -> assoc_handle ; if ( $ assoc_handle ) { $ assoc = $ this -> getAssociation ( $ assoc_handle , false , false ) ; if ( ! $ assoc || ( $ assoc -> getExpiresIn ( ) <= 0 ) ) { $ signed_response ->...
Given a response sign the fields in the response s signed list and insert the signature into the response .
59,631
function createAssociation ( $ dumb = true , $ assoc_type = 'HMAC-SHA1' ) { $ secret = Auth_OpenID_CryptUtil :: getBytes ( Auth_OpenID_getSecretSize ( $ assoc_type ) ) ; $ uniq = base64_encode ( Auth_OpenID_CryptUtil :: getBytes ( 4 ) ) ; $ handle = sprintf ( '{%s}{%x}{%s}' , $ assoc_type , intval ( time ( ) ) , $ uniq...
Make a new association .
59,632
function getAssociation ( $ assoc_handle , $ dumb , $ check_expiration = true ) { if ( $ assoc_handle === null ) { return new Auth_OpenID_ServerError ( null , "assoc_handle must not be null" ) ; } if ( $ dumb ) { $ key = $ this -> dumb_key ; } else { $ key = $ this -> normal_key ; } $ assoc = $ this -> store -> getAsso...
Given an association handle get the association from the store or return a ServerError or null if something goes wrong .
59,633
function invalidate ( $ assoc_handle , $ dumb ) { if ( $ dumb ) { $ key = $ this -> dumb_key ; } else { $ key = $ this -> normal_key ; } $ this -> store -> removeAssociation ( $ key , $ assoc_handle ) ; }
Invalidate a given association handle .
59,634
function openid_associate ( $ request ) { $ assoc_type = $ request -> assoc_type ; $ session_type = $ request -> session -> session_type ; if ( $ this -> negotiator -> isAllowed ( $ assoc_type , $ session_type ) ) { $ assoc = $ this -> signatory -> createAssociation ( false , $ assoc_type ) ; return $ request -> answer...
The callback for associate messages .
59,635
function parseExtensionArgs ( $ args ) { $ this -> preferred_auth_policies = array ( ) ; $ policies_str = Auth_OpenID :: arrayGet ( $ args , 'preferred_auth_policies' ) ; if ( $ policies_str ) { foreach ( explode ( ' ' , $ policies_str ) as $ uri ) { if ( ! in_array ( $ uri , $ this -> preferred_auth_policies ) ) { $ t...
Set the state of this request to be that expressed in these PAPE arguments
59,636
function preferredTypes ( $ supported_types ) { $ result = array ( ) ; foreach ( $ supported_types as $ st ) { if ( in_array ( $ st , $ this -> preferred_auth_policies ) ) { $ result [ ] = $ st ; } } return $ result ; }
Given a list of authentication policy URIs that a provider supports this method returns the subsequence of those types that are preferred by the relying party .
59,637
static function fromSuccessResponse ( $ success_response ) { $ obj = new Auth_OpenID_PAPE_Response ( ) ; $ args = $ success_response -> getSignedNS ( Auth_OpenID_PAPE_NS_URI ) ; if ( $ args === null || $ args === array ( ) ) { return null ; } $ result = $ obj -> parseExtensionArgs ( $ args ) ; if ( $ result === false )...
Create an Auth_OpenID_PAPE_Response object from a successful OpenID library response .
59,638
function parseExtensionArgs ( $ args , $ strict = false ) { $ policies_str = Auth_OpenID :: arrayGet ( $ args , 'auth_policies' ) ; if ( $ policies_str && $ policies_str != "none" ) { $ this -> auth_policies = explode ( " " , $ policies_str ) ; } $ nist_level_str = Auth_OpenID :: arrayGet ( $ args , 'nist_auth_level' )...
Parse the provider authentication policy arguments into the internal state of this object
59,639
static function _parse ( $ trust_root ) { $ trust_root = Auth_OpenID_urinorm ( $ trust_root ) ; if ( $ trust_root === null ) { return false ; } if ( preg_match ( "/:\/\/[^:]+(:\d+){2,}(\/|$)/" , $ trust_root ) ) { return false ; } $ parts = @ parse_url ( $ trust_root ) ; if ( $ parts === false ) { return false ; } $ re...
Parse a URL into its trust_root parts .
59,640
static function isSane ( $ trust_root ) { $ parts = Auth_OpenID_TrustRoot :: _parse ( $ trust_root ) ; if ( $ parts === false ) { return false ; } if ( $ parts [ 'host' ] == 'localhost' ) { return true ; } $ host_parts = explode ( '.' , $ parts [ 'host' ] ) ; if ( $ parts [ 'wildcard' ] ) { array_shift ( $ host_parts )...
Is this trust root sane?
59,641
static function match ( $ trust_root , $ url ) { $ trust_root_parsed = Auth_OpenID_TrustRoot :: _parse ( $ trust_root ) ; $ url_parsed = Auth_OpenID_TrustRoot :: _parse ( $ url ) ; if ( ! $ trust_root_parsed || ! $ url_parsed ) { return false ; } if ( $ url_parsed [ 'wildcard' ] ) { return false ; } if ( $ trust_root_p...
Does this URL match the given trust root?
59,642
function set ( $ key , $ value ) { $ index = array_search ( $ key , $ this -> keys ) ; if ( $ index !== false ) { $ this -> values [ $ index ] = $ value ; } else { $ this -> keys [ ] = $ key ; $ this -> values [ ] = $ value ; } }
Sets a key - value pair in the mapping . If the key already exists its value is replaced with the new value .
59,643
function del ( $ key ) { $ index = array_search ( $ key , $ this -> keys ) ; if ( $ index !== false ) { unset ( $ this -> keys [ $ index ] ) ; unset ( $ this -> values [ $ index ] ) ; $ this -> _reflow ( ) ; return true ; } return false ; }
Deletes a key - value pair from the mapping with the specified key .
59,644
function sign ( $ openid , $ attribute , $ value ) { $ samlObj = new SAML ( ) ; $ responseXmlString = $ samlObj -> createSamlAssertion ( $ openid , $ this -> notBefore , $ this -> notOnOrAfter , $ this -> rsadsa , $ this -> acsURI , $ attribute , sha1 ( $ value ) , $ this -> assertionTemplate ) ; $ signedAssertion = $ ...
Create the signed assertion .
59,645
function verify ( $ responseXmlString ) { $ samlObj = new SAML ( ) ; $ ret = $ samlObj -> verifyAssertion ( $ responseXmlString , $ this -> rootcert ) ; return $ ret ; }
Verifies the certificate given the SAML document .
59,646
static function createStoreRequest ( & $ auth_request , & $ attributeProvider , $ attribute , $ value , $ openid ) { if ( ! $ auth_request ) { return null ; } $ signedAssertion = $ attributeProvider -> sign ( $ openid , $ attribute , $ value ) ; $ store_request = new Auth_OpenID_AX_StoreRequest ; $ store_request -> add...
Creates store request and adds it as an extension to AuthRequest object passed to it .
59,647
function verifyAssertion ( & $ attributeVerifier , $ response ) { $ ax_resp = Auth_OpenID_AX_FetchResponse :: fromSuccessResponse ( $ response ) ; if ( $ ax_resp instanceof Auth_OpenID_AX_FetchResponse ) { $ ax_args = $ ax_resp -> getExtensionArgs ( ) ; if ( $ ax_args ) { $ value = base64_decode ( $ ax_args [ 'value.ex...
Verifies a given signed assertion .
59,648
function supportsSSL ( ) { $ v = curl_version ( ) ; if ( is_array ( $ v ) ) { return in_array ( 'https' , $ v [ 'protocols' ] ) ; } elseif ( is_string ( $ v ) ) { return preg_match ( '/OpenSSL/i' , $ v ) ; } else { return 0 ; } }
Does this fetcher support SSL URLs?
59,649
function canFetchURL ( $ url ) { if ( $ this -> isHTTPS ( $ url ) && ! $ this -> supportsSSL ( ) ) { Auth_OpenID :: log ( "HTTPS URL unsupported fetching %s" , $ url ) ; return false ; } if ( ! $ this -> allowedURL ( $ url ) ) { Auth_OpenID :: log ( "URL fetching not allowed for '%s'" , $ url ) ; return false ; } retur...
Return whether a URL can be fetched . Returns false if the URL scheme is not allowed or is not supported by this fetcher implementation ; returns true otherwise .
59,650
function _setup ( ) { return ( Auth_OpenID :: ensureDir ( $ this -> nonce_dir ) && Auth_OpenID :: ensureDir ( $ this -> association_dir ) && Auth_OpenID :: ensureDir ( $ this -> temp_dir ) ) ; }
Make sure that the directories in which we store our data exist .
59,651
function getAssociationFilename ( $ server_url , $ handle ) { if ( ! $ this -> active ) { trigger_error ( "FileStore no longer active" , E_USER_ERROR ) ; return null ; } if ( strpos ( $ server_url , '://' ) === false ) { trigger_error ( sprintf ( "Bad server URL: %s" , $ server_url ) , E_USER_WARNING ) ; return null ; ...
Create a unique filename for a given server url and handle . This implementation does not assume anything about the format of the handle . The filename that is returned will contain the domain name from the server URL for ease of human inspection of the data directory .
59,652
function storeAssociation ( $ server_url , $ association ) { if ( ! $ this -> active ) { trigger_error ( "FileStore no longer active" , E_USER_ERROR ) ; return false ; } $ association_s = $ association -> serialize ( ) ; $ filename = $ this -> getAssociationFilename ( $ server_url , $ association -> handle ) ; list ( $...
Store an association in the association directory .
59,653
function getAssociation ( $ server_url , $ handle = null ) { if ( ! $ this -> active ) { trigger_error ( "FileStore no longer active" , E_USER_ERROR ) ; return null ; } if ( $ handle === null ) { $ handle = '' ; } $ filename = $ this -> getAssociationFilename ( $ server_url , $ handle ) ; if ( $ handle ) { return $ thi...
Retrieve an association . If no handle is specified return the association with the most recent issue time .
59,654
function removeAssociation ( $ server_url , $ handle ) { if ( ! $ this -> active ) { trigger_error ( "FileStore no longer active" , E_USER_ERROR ) ; return null ; } $ assoc = $ this -> getAssociation ( $ server_url , $ handle ) ; if ( $ assoc === null ) { return false ; } else { $ filename = $ this -> getAssociationFil...
Remove an association if it exists . Do nothing if it does not .
59,655
function useNonce ( $ server_url , $ timestamp , $ salt ) { global $ Auth_OpenID_SKEW ; if ( ! $ this -> active ) { trigger_error ( "FileStore no longer active" , E_USER_ERROR ) ; return null ; } if ( abs ( $ timestamp - time ( ) ) > $ Auth_OpenID_SKEW ) { return false ; } if ( $ server_url ) { list ( $ proto , $ rest ...
Return whether this nonce is present . As a side effect mark it as no longer present .
59,656
function _allAssocs ( ) { $ all_associations = array ( ) ; $ association_filenames = Auth_OpenID_FileStore :: _listdir ( $ this -> association_dir ) ; foreach ( $ association_filenames as $ association_filename ) { $ association_file = fopen ( $ association_filename , 'rb' ) ; if ( $ association_file !== false ) { $ as...
Remove expired entries from the database . This is potentially expensive so only run when it is acceptable to take time .
59,657
function _checkMode ( $ ax_args ) { $ mode = Auth_OpenID :: arrayGet ( $ ax_args , 'mode' ) ; if ( $ mode != $ this -> mode ) { return new Auth_OpenID_AX_Error ( sprintf ( "Expected mode '%s'; got '%s'" , $ this -> mode , $ mode ) ) ; } return true ; }
Return Auth_OpenID_AX_Error if the mode in the attribute exchange arguments does not match what is expected for this class ; true otherwise .
59,658
static function make ( $ type_uri , $ count = 1 , $ required = false , $ alias = null ) { if ( $ alias !== null ) { $ result = Auth_OpenID_AX_checkAlias ( $ alias ) ; if ( Auth_OpenID_AX :: isError ( $ result ) ) { return $ result ; } } return new Auth_OpenID_AX_AttrInfo ( $ type_uri , $ count , $ required , $ alias ) ...
Construct an attribute information object . For parameter details see the constructor .
59,659
function add ( $ attribute ) { if ( $ this -> contains ( $ attribute -> type_uri ) ) { return new Auth_OpenID_AX_Error ( sprintf ( "The attribute %s has already been requested" , $ attribute -> type_uri ) ) ; } $ this -> requested_attributes [ $ attribute -> type_uri ] = $ attribute ; return true ; }
Add an attribute to this attribute exchange request .
59,660
function getExtensionArgs ( $ request = null ) { $ aliases = new Auth_OpenID_NamespaceMap ( ) ; $ required = array ( ) ; $ if_available = array ( ) ; $ ax_args = $ this -> _newArgs ( ) ; foreach ( $ this -> requested_attributes as $ type_uri => $ attribute ) { if ( $ attribute -> alias === null ) { $ alias = $ aliases ...
Get the serialized form of this attribute fetch request .
59,661
function getRequiredAttrs ( ) { $ required = array ( ) ; foreach ( $ this -> requested_attributes as $ type_uri => $ attribute ) { if ( $ attribute -> required ) { $ required [ ] = $ type_uri ; } } return $ required ; }
Get the type URIs for all attributes that have been marked as required .
59,662
static function fromOpenIDRequest ( $ request ) { $ m = $ request -> message ; $ obj = new Auth_OpenID_AX_FetchRequest ( ) ; $ ax_args = $ m -> getArgs ( $ obj -> ns_uri ) ; $ result = $ obj -> parseExtensionArgs ( $ ax_args ) ; if ( Auth_OpenID_AX :: isError ( $ result ) ) { return $ result ; } if ( $ obj -> update_ur...
Extract a FetchRequest from an OpenID message
59,663
function parseExtensionArgs ( $ ax_args ) { $ result = $ this -> _checkMode ( $ ax_args ) ; if ( Auth_OpenID_AX :: isError ( $ result ) ) { return $ result ; } $ aliases = new Auth_OpenID_NamespaceMap ( ) ; foreach ( $ ax_args as $ key => $ value ) { if ( strpos ( $ key , 'type.' ) === 0 ) { $ alias = substr ( $ key , ...
Given attribute exchange arguments populate this FetchRequest .
59,664
function addValue ( $ type_uri , $ value ) { if ( ! array_key_exists ( $ type_uri , $ this -> data ) ) { $ this -> data [ $ type_uri ] = array ( ) ; } $ values = & $ this -> data [ $ type_uri ] ; $ values [ ] = $ value ; }
Add a single value for the given attribute type to the message . If there are already values specified for this type this value will be sent in addition to the values already specified .
59,665
function getSingle ( $ type_uri , $ default = null ) { $ values = Auth_OpenID :: arrayGet ( $ this -> data , $ type_uri ) ; if ( ! $ values ) { return $ default ; } else if ( count ( $ values ) == 1 ) { return $ values [ 0 ] ; } else { return new Auth_OpenID_AX_Error ( sprintf ( 'More than one value present for %s' , $...
Get a single value for an attribute . If no value was sent for this attribute use the supplied default . If there is more than one value for this attribute this method will fail .
59,666
function get ( $ type_uri ) { if ( array_key_exists ( $ type_uri , $ this -> data ) ) { return $ this -> data [ $ type_uri ] ; } else { return new Auth_OpenID_AX_Error ( sprintf ( "Type URI %s not found in response" , $ type_uri ) ) ; } }
Get the list of values for this attribute in the fetch_response .
59,667
function getExtensionArgs ( $ request = null ) { $ aliases = new Auth_OpenID_NamespaceMap ( ) ; $ zero_value_types = array ( ) ; if ( $ request !== null ) { foreach ( $ this -> data as $ type_uri => $ unused ) { if ( ! $ request -> contains ( $ type_uri ) ) { return new Auth_OpenID_AX_Error ( sprintf ( "Response attrib...
Serialize this object into arguments in the attribute exchange namespace
59,668
static function fromSuccessResponse ( $ success_response , $ signed = true ) { $ obj = new Auth_OpenID_AX_FetchResponse ( ) ; if ( $ signed ) { $ ax_args = $ success_response -> getSignedNS ( $ obj -> ns_uri ) ; } else { $ ax_args = $ success_response -> message -> getArgs ( $ obj -> ns_uri ) ; } if ( $ ax_args === nul...
Construct a FetchResponse object from an OpenID library SuccessResponse object .
59,669
function get ( $ name , $ default = null ) { if ( isset ( $ _SESSION ) && array_key_exists ( $ name , $ _SESSION ) ) { return $ _SESSION [ $ name ] ; } else { return $ default ; } }
Get a key s value from the session .
59,670
function nextService ( ) { if ( $ this -> services ) { $ this -> _current = array_shift ( $ this -> services ) ; } else { $ this -> _current = null ; } return $ this -> _current ; }
Return the next service
59,671
function getNextService ( $ discover_cb , $ fetcher ) { $ manager = $ this -> getManager ( ) ; if ( ! $ manager || ( ! $ manager -> services ) ) { $ this -> destroyManager ( ) ; list ( $ yadis_url , $ services ) = call_user_func_array ( $ discover_cb , array ( $ this -> url , $ fetcher , ) ) ; $ manager = $ this -> cre...
Return the next authentication service for the pair of user_input and session . This function handles fallback .
59,672
function cleanup ( $ force = false ) { $ manager = $ this -> getManager ( $ force ) ; if ( $ manager ) { $ service = $ manager -> current ( ) ; $ this -> destroyManager ( $ force ) ; } else { $ service = null ; } return $ service ; }
Clean up Yadis - related services in the session and return the most - recently - attempted service from the manager if one exists .
59,673
static function build ( $ required = null , $ optional = null , $ policy_url = null , $ sreg_ns_uri = Auth_OpenID_SREG_NS_URI , $ cls = 'Auth_OpenID_SRegRequest' ) { $ obj = new $ cls ( ) ; $ obj -> required = array ( ) ; $ obj -> optional = array ( ) ; $ obj -> policy_url = $ policy_url ; $ obj -> ns_uri = $ sreg_ns_u...
Initialize an empty simple registration request .
59,674
static function fromOpenIDRequest ( $ request , $ cls = 'Auth_OpenID_SRegRequest' ) { $ obj = call_user_func_array ( array ( $ cls , 'build' ) , array ( null , null , null , Auth_OpenID_SREG_NS_URI , $ cls ) ) ; $ m = $ request -> message ; $ obj -> ns_uri = $ obj -> _getSRegNS ( $ m ) ; $ args = $ m -> getArgs ( $ obj...
Create a simple registration request that contains the fields that were requested in the OpenID request with the given arguments
59,675
function parseExtensionArgs ( $ args , $ strict = false ) { foreach ( array ( 'required' , 'optional' ) as $ list_name ) { $ required = ( $ list_name == 'required' ) ; $ items = Auth_OpenID :: arrayGet ( $ args , $ list_name ) ; if ( $ items ) { foreach ( explode ( ',' , $ items ) as $ field_name ) { if ( ! $ this -> r...
Parse the unqualified simple registration request parameters and add them to this object .
59,676
function contains ( $ field_name ) { return ( in_array ( $ field_name , $ this -> required ) || in_array ( $ field_name , $ this -> optional ) ) ; }
Was this field in the request?
59,677
function requestField ( $ field_name , $ required = false , $ strict = false ) { if ( ! Auth_OpenID_checkFieldName ( $ field_name ) ) { return false ; } if ( $ strict ) { if ( $ this -> contains ( $ field_name ) ) { return false ; } } else { if ( in_array ( $ field_name , $ this -> required ) ) { return true ; } if ( i...
Request the specified field from the OpenID user
59,678
function requestFields ( $ field_names , $ required = false , $ strict = false ) { if ( ! is_array ( $ field_names ) ) { return false ; } foreach ( $ field_names as $ field_name ) { if ( ! $ this -> requestField ( $ field_name , $ required , $ strict ) ) { return false ; } } return true ; }
Add the given list of fields to the request
59,679
function getExtensionArgs ( $ request = null ) { $ args = array ( ) ; if ( $ this -> required ) { $ args [ 'required' ] = implode ( ',' , $ this -> required ) ; } if ( $ this -> optional ) { $ args [ 'optional' ] = implode ( ',' , $ this -> optional ) ; } if ( $ this -> policy_url ) { $ args [ 'policy_url' ] = $ this -...
Get a dictionary of unqualified simple registration arguments representing this request .
59,680
function get ( $ field_name , $ default = null ) { if ( ! Auth_OpenID_checkFieldName ( $ field_name ) ) { return null ; } return Auth_OpenID :: arrayGet ( $ this -> data , $ field_name , $ default ) ; }
Read - only dictionary interface
59,681
function tagPattern ( $ tag_names , $ close , $ self_close ) { if ( is_array ( $ tag_names ) ) { $ tag_names = '(?:' . implode ( '|' , $ tag_names ) . ')' ; } if ( $ close ) { $ close = '\/' . ( ( $ close == 1 ) ? '' : '?' ) ; } else { $ close = '' ; } if ( $ self_close ) { $ self_close = '(?:\/\s*)' . ( ( $ self_close...
Create a regular expression that will match an opening or closing tag from a set of names .
59,682
function toMessage ( $ message , $ request = null ) { $ implicit = $ message -> isOpenID1 ( ) ; $ added = $ message -> namespaces -> addAlias ( $ this -> ns_uri , $ this -> ns_alias , $ implicit ) ; if ( $ added === null ) { if ( $ message -> namespaces -> getAlias ( $ this -> ns_uri ) != $ this -> ns_alias ) { return ...
Add the arguments from this extension to the provided message .
59,683
function storeAssociation ( $ server_url , $ association ) { $ associationKey = $ this -> associationKey ( $ server_url , $ association -> handle ) ; $ serverKey = $ this -> associationServerKey ( $ server_url ) ; $ this -> redis -> lpush ( $ serverKey , $ associationKey ) ; $ newExpiration = ( $ association -> issued ...
Store association until its expiration time in Redis server . Overwrites any existing association with same server_url and handle . Handles list of associations for every server .
59,684
function getAssociation ( $ server_url , $ handle = null ) { if ( $ handle !== null ) { return $ this -> getAssociationFromServer ( $ this -> associationKey ( $ server_url , $ handle ) ) ; } $ serverKey = $ this -> associationServerKey ( $ server_url ) ; $ lastKey = $ this -> redis -> lindex ( $ serverKey , - 1 ) ; if ...
Read association from Redis . If no handle given and multiple associations found returns latest issued
59,685
private function getAssociationFromServer ( $ associationKey ) { $ association = $ this -> redis -> get ( $ associationKey ) ; return $ association ? unserialize ( $ association ) : null ; }
Function to actually receive and unserialize the association from the server .
59,686
function removeAssociation ( $ server_url , $ handle ) { $ serverKey = $ this -> associationServerKey ( $ server_url ) ; $ associationKey = $ this -> associationKey ( $ server_url , $ handle ) ; $ removed = $ this -> redis -> lrem ( $ serverKey , 0 , $ associationKey ) ; if ( $ removed < 1 ) { return false ; } return $...
Immediately delete association from Redis .
59,687
function getTypes ( ) { $ t = array ( ) ; foreach ( $ this -> getElements ( 'xrd:Type' ) as $ elem ) { $ c = $ this -> parser -> content ( $ elem ) ; if ( $ c ) { $ t [ ] = $ c ; } } return $ t ; }
Return the URIs in the Type elements if any of this Service element .
59,688
function getURIs ( ) { $ uris = array ( ) ; $ last = array ( ) ; foreach ( $ this -> getElements ( 'xrd:URI' ) as $ elem ) { $ uri_string = $ this -> parser -> content ( $ elem ) ; $ attrs = $ this -> parser -> attributes ( $ elem ) ; if ( $ attrs && array_key_exists ( 'priority' , $ attrs ) ) { $ priority = intval ( $...
Return the URIs in the URI elements if any of this Service element . The URIs are returned sorted in priority order .
59,689
function _parse ( ) { $ this -> serviceList = array ( ) ; $ services = $ this -> parser -> evalXPath ( 'xrd:Service' , $ this -> xrdNode ) ; foreach ( $ services as $ node ) { $ s = new Auth_Yadis_Service ( ) ; $ s -> element = $ node ; $ s -> parser = $ this -> parser ; $ priority = $ s -> getPriority ( ) ; if ( $ pri...
Creates the service list using nodes from the XRDS XML document .
59,690
function tagMatcher ( $ tag_name , $ close_tags = null ) { $ expr = $ this -> _tag_expr ; if ( $ close_tags ) { $ options = implode ( "|" , array_merge ( array ( $ tag_name ) , $ close_tags ) ) ; $ closer = sprintf ( "(?:%s)" , $ options ) ; } else { $ closer = $ tag_name ; } $ expr = sprintf ( $ expr , $ tag_name , $ ...
Returns a regular expression that will match a given tag in an SGML string .
59,691
function parseLinkAttrs ( $ html ) { $ stripped = preg_replace ( $ this -> _removed_re , "" , $ html ) ; $ html_begin = $ this -> htmlBegin ( $ stripped ) ; $ html_end = $ this -> htmlEnd ( $ stripped ) ; if ( $ html_begin === false ) { return array ( ) ; } if ( $ html_end === false ) { $ html_end = strlen ( $ stripped...
Find all link tags in a string representing a HTML document and return a list of their attributes .
59,692
function begin ( $ user_url , $ anonymous = false ) { $ openid_url = $ user_url ; $ disco = $ this -> getDiscoveryObject ( $ this -> session , $ openid_url , $ this -> session_key_prefix ) ; $ m = $ disco -> getManager ( ) ; $ loader = new Auth_Yadis_ManagerLoader ( ) ; if ( $ m ) { if ( $ m -> stale ) { $ disco -> des...
Start the OpenID authentication process . See steps 1 - 2 in the overview at the top of this file .
59,693
function beginWithoutDiscovery ( $ endpoint , $ anonymous = false ) { $ loader = new Auth_OpenID_ServiceEndpointLoader ( ) ; $ auth_req = $ this -> consumer -> begin ( $ endpoint ) ; $ this -> session -> set ( $ this -> _token_key , $ loader -> toSession ( $ auth_req -> endpoint ) ) ; if ( ! $ auth_req -> setAnonymous ...
Start OpenID verification without doing OpenID server discovery . This method is used internally by Consumer . begin after discovery is performed and exists to provide an interface for library users needing to perform their own discovery .
59,694
function complete ( $ current_url , $ query = null ) { if ( $ current_url && ! is_string ( $ current_url ) ) { trigger_error ( "current_url must be a string; see NEWS file " . "for upgrading notes." , E_USER_ERROR ) ; } if ( $ query === null ) { $ query = Auth_OpenID :: getQuery ( ) ; } $ loader = new Auth_OpenID_Servi...
Called to interpret the server s response to an OpenID request . It is called in step 4 of the flow described in the consumer overview .
59,695
static function _httpResponseToMessage ( $ response ) { $ response_message = Auth_OpenID_Message :: fromKVForm ( $ response -> body ) ; if ( $ response -> status == 400 ) { return Auth_OpenID_ServerErrorContainer :: fromMessage ( $ response_message ) ; } else if ( $ response -> status != 200 and $ response -> status !=...
Adapt a POST response to a Message .
59,696
function _extractSupportedAssociationType ( $ server_error ) { if ( ( $ server_error -> error_code != 'unsupported-type' ) || ( $ server_error -> message -> isOpenID1 ( ) ) ) { return null ; } $ assoc_type = $ server_error -> message -> getArg ( Auth_OpenID_OPENID_NS , 'assoc_type' ) ; $ session_type = $ server_error -...
Handle ServerErrors resulting from association requests .
59,697
function _getOpenID1SessionType ( $ assoc_response ) { $ session_type = $ assoc_response -> getArg ( Auth_OpenID_OPENID1_NS , 'session_type' ) ; if ( $ session_type == 'no-encryption' ) { } else if ( ( $ session_type == '' ) || ( $ session_type === null ) ) { $ session_type = 'no-encryption' ; } return $ session_type ;...
Given an association response message extract the OpenID 1 . X session type .
59,698
function setAnonymous ( $ is_anonymous ) { if ( $ is_anonymous && $ this -> message -> isOpenID1 ( ) ) { return false ; } else { $ this -> _anonymous = $ is_anonymous ; return true ; } }
Set whether this request should be made anonymously . If a request is anonymous the identifier will not be sent in the request . This is only useful if you are making another kind of request with an extension in this request .
59,699
function formMarkup ( $ realm , $ return_to = null , $ immediate = false , $ form_tag_attrs = null ) { $ message = $ this -> getMessage ( $ realm , $ return_to , $ immediate ) ; if ( Auth_OpenID :: isFailure ( $ message ) ) { return $ message ; } return $ message -> toFormMarkup ( $ this -> endpoint -> server_url , $ f...
Get html for a form to submit this request to the IDP .