start() $options = new ezcAuthenticationSessionOptions(); // setting 10 seconds timeout for session for testing purposes only $options->validity = 60; $session = new ezcAuthenticationSession( $options ); $session->start(); $setupUrl = isset( $_GET['openid_user_setup_url'] ) ? $_GET['openid_user_setup_url'] : null; $immediate = isset( $_GET['immediate'] ) ? $_GET['immediate'] : false; if ( $setupUrl !== null ) { $urlParts = parse_url( $setupUrl ); parse_str( $urlParts['query'], $parts ); $identity = $parts['openid_identity']; } else { $identity = $session->load(); } $url = isset( $_GET['openid_identifier'] ) ? $_GET['openid_identifier'] : $identity; $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : null; $credentials = new ezcAuthenticationIdCredentials( $url ); $authentication = new ezcAuthentication( $credentials ); $authentication->session = $session; if ( $action === 'logout' ) { $session->destroy(); } else { $options = new ezcAuthenticationOpenidOptions(); // for checkid_immediate if ( $immediate !== false ) { $options->immediate = true; } $filter = new ezcAuthenticationOpenidFilter( $options ); // it seems that fetching extra data does not work with checkid_immediate $filter->registerFetchData( array( 'fullname', 'gender', 'country', 'language' ) ); $authentication->addFilter( $filter ); } if ( !$authentication->run() ) { $setupUrl = $filter->getSetupUrl(); if ( !empty( $setupUrl ) ) { // the setup URL will be read by the main window echo $setupUrl; } else { echo 'Authentication did not succeed.'; } } else { ?>