Apache Zeta Components Manual :: File Source for typekey_options.php
Source for file typekey_options.php
Documentation is available at typekey_options.php
* File containing the ezcAuthenticationTypekeyOptions class.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @package Authentication
* Class containing the options for the TypeKey authentication filter.
* // create an options object
* $options = new ezcAuthenticationTypekeyOptions();
* $options->validity = 60;
* $options->keysFile = '/tmp/typekey_keys.txt';
* $options->requestSource = $_POST;
* // use the options object when creating a new TypeKey filter
* $filter = new ezcAuthenticationTypekeyFilter( $options );
* // alternatively, you can set the options to an existing filter
* $filter = new ezcAuthenticationTypekeyFilter();
* $filter->setOptions( $options );
* @property int $validity
* The maximum timespan that can exist between the timestamp
* sent by the application server at log-in and the timestamp sent
* by the TypeKey server. A value of 0 means the validity value
* is not taken into consideration when validating the response
* sent by the TypeKey server. Do not use a value too small, as
* the servers might not be synchronized.
* @property string $keysFile
* The file from where to retrieve the public keys which are used
* for checking the TypeKey signature. Can be a local file or a
* URL. Default is http://www.typekey.com/extras/regkeys.txt.
* Developers can save the file locally once per day to improve the
* speed of the TypeKey authentication (which reads this file
* at every authentication attempt).
* @property array(string=>mixed) $requestSource
* From where to get the parameters returned by the TypeKey server.
* @package Authentication
* Constructs an object with the specified values.
* @throws ezcBasePropertyNotFoundException
* if $options contains a property not defined
* @throws ezcBaseValueException
* if $options contains a property with a value not allowed
* @throws ezcBaseFileNotFoundException
* if the $value file does not exist
* @throws ezcBaseFilePermissionException
* if the $value file cannot be opened for reading
* @param array(string=>mixed) $options Options for this class
public function __construct( array $options =
array() )
$this->validity =
0; // seconds
$this->keysFile =
'http://www.typekey.com/extras/regkeys.txt';
$this->requestSource =
( $_GET !==
null ) ?
$_GET :
array();
* Sets the option $name to $value.
* @throws ezcBasePropertyNotFoundException
* if the property $name is not defined
* @throws ezcBaseValueException
* if $value is not correct for the property $name
* @throws ezcBaseFileNotFoundException
* if the $value file does not exist
* @throws ezcBaseFilePermissionException
* if the $value file cannot be opened for reading
* @param string $name The name of the property to set
* @param mixed $value The new value of the property
public function __set( $name, $value )
if ( strpos( $value, '://' ) ===
false )
// if $value is not an URL
// hide the notices caused by getaddrinfo (php_network_getaddresses)
// in case of unreachable hosts ("Name or service not known")
||
count( $headers ) ===
0 // get_headers returns an empty array for unreachable hosts
||
strpos( $headers[0], '404 Not Found' ) !==
false
parent::__set( $name, $value );