Apache Zeta Components Manual :: File Source for openid_file_store.php
Source for file openid_file_store.php
Documentation is available at openid_file_store.php
* File containing the ezcAuthenticationOpenidFileStore 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 providing file storage for OpenID authentication.
* // create an OpenID options object
* $options = new ezcAuthenticationOpenidOptions();
* $options->mode = ezcAuthenticationOpenidFilter::MODE_SMART;
* $options->store = new ezcAuthenticationOpenidFileStore( '/tmp/store' );
* // create an OpenID filter based on the options object
* $filter = new ezcAuthenticationOpenidFilter( $options );
* The path where the files will be kept. It must exist and it must
* @package Authentication
* Holds the properties of this class.
* @var array(string=>mixed)
private $properties =
array();
* Creates a new object of this class.
* @throws ezcBaseFileNotFoundException
* if $path does not exist
* @throws ezcBaseFilePermissionException
* if $path cannot be opened for reading and writing
* @param string $path The path where to save the nonces
* @param ezcAuthenticationOpenidFileStoreOptions $options Options for this class
public function __construct( $path, ezcAuthenticationOpenidFileStoreOptions $options =
null )
* Sets the property $name to $value.
* @throws ezcBasePropertyNotFoundException
* if the property $name does not exist
* @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 and writing
* @param string $name The name of the property to set
* @param mixed $value The new value of the property
public function __set( $name, $value )
$this->properties[$name] =
$value;
* Returns the value of the property $name.
* @throws ezcBasePropertyNotFoundException
* if the property $name does not exist
* @param string $name The name of the property for which to return the value
public function __get( $name )
return $this->properties[$name];
* Returns true if the property $name is set, otherwise false.
* @param string $name The name of the property to test if it is set
public function __isset( $name )
return isset
( $this->properties[$name] );
* Stores the nonce in the store.
* Returns true if the nonce was stored successfully, and false otherwise.
* @throws ezcBaseFilePermissionException
* if the nonce cannot be written in the store
* @param string $nonce The nonce value to store
$file =
$this->path .
DIRECTORY_SEPARATOR .
$nonce;
// suppress warnings caused by fopen() if $file could not be opened
$fh =
@fopen( $file, 'w' );
* Checks if the nonce exists and afterwards deletes it.
* Returns the timestamp of the nonce if it exists, and false otherwise.
* @param string $nonce The nonce value to check and delete
$file =
$this->path .
DIRECTORY_SEPARATOR .
$nonce;
* Stores an association in the store linked to the OpenID provider URL.
* Returns true if the association was stored successfully, and false
* @throws ezcBaseFilePermissionException
* if the nonce cannot be written in the store
* @param string $url The URL of the OpenID provider
* @param ezcAuthenticationOpenidAssociation $association The association value to store
// suppress warnings caused by fopen() if $file could not be opened
$fh =
@fopen( $file, 'w' );
* Returns the unserialized association linked to the OpenID provider URL.
* Returns false if the association could not be retrieved or if it expired.
* @param string $url The URL of the OpenID provider
* @return ezcAuthenticationOpenidAssociation
* Removes the association linked to the OpenID provider URL.
* Returns true if the association could be removed, and false otherwise.
* @param string $url The URL of the OpenID provider
* Creates a valid filename from the provided string.
* @param string $value A string which needs to be used as a valid filename