本文整理汇总了PHP中Hybrid_Endpoint::process方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Endpoint::process方法的具体用法?PHP Hybrid_Endpoint::process怎么用?PHP Hybrid_Endpoint::process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hybrid_Endpoint
的用法示例。
在下文中一共展示了Hybrid_Endpoint::process方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGoogleLogin
public function getGoogleLogin($auth = NULL)
{
if ($auth == 'auth') {
Hybrid_Endpoint::process();
}
try {
$oauth = new Hybrid_Auth(app_path() . '/config/google_auth.php');
$provider = $oauth->authenticate('Google');
$profile = $provider->getUserProfile();
} catch (exception $e) {
return $e->getMessage();
}
if ($user = User::where('email', '=', $profile->email)->first()) {
Auth::login($user, true);
return Redirect::intended('/');
}
return App::make('frontend\\UserController')->doSignUp(array('email' => $profile->email, 'login' => $profile->identifier, 'password' => "pass1234", 'f_name' => $profile->firstName, 'l_name' => $profile->lastName));
}
示例2: loginAction
public function loginAction()
{
\Hybrid_Endpoint::process();
}
示例3: createLoginProviderEntity
/**
* @return LoginProviderEntity
*/
protected function createLoginProviderEntity()
{
$type = $this->getHybridType();
//dump($this->getCallbackUrl());die($this->getCallbackUrl());
$params = array('base_url' => $this->getCallbackUrl(), 'providers' => array($type => $this->getConfig() + array('enabled' => TRUE)));
$hybridauth = new \Hybrid_Auth($params);
if (isset($_REQUEST['hauth_start']) || isset($_REQUEST['hauth_done'])) {
\Hybrid_Endpoint::process();
}
/** @var \Hybrid_User_Profile $user */
$user = $hybridauth->authenticate($this->getHybridType(), $this->authenticationParameters)->getUserProfile();
$ret = new LoginProviderEntity($user->identifier, static::getType());
return $ret;
}
示例4: loginWithSocial
public function loginWithSocial($social_provider, $action = "")
{
// check URL segment
if ($action == "auth") {
// process authentication
try {
Session::set('provider', $social_provider);
Hybrid_Endpoint::process();
} catch (Exception $e) {
// redirect back to http://URL/social/
return Redirect::route('loginWith');
}
return;
}
try {
// create a HybridAuth object
$socialAuth = new Hybrid_Auth(app_path() . '/config/hybridauth.php');
// authenticate with Provider
$provider = $socialAuth->authenticate($social_provider);
// fetch user profile
$userProfile = $provider->getUserProfile();
} catch (Exception $e) {
// exception codes can be found on HybBridAuth's web site
Session::flash('error_msg', $e->getMessage());
return Redirect::to('/login');
}
$this->createOAuthProfile($userProfile);
return Redirect::to('/');
}
示例5: endpoint
function endpoint()
{
jimport('hs.user.lib.Hybrid.Auth');
jimport('hs.user.lib.Hybrid.Endpoint');
// require_once (JPATH_COMPONENT_SITE . '/lib/Hybrid/Auth.php');
// require_once (JPATH_COMPONENT_SITE . '/lib/Hybrid/Endpoint.php');
Hybrid_Endpoint::process();
}
示例6: indexAction
public function indexAction()
{
ob_start();
echo "<pre>";
print_r(\Hybrid_Endpoint::process());
exit;
ob_end_flush();
}
示例7: processEndpoint
/**
* process the
*
* @return string
*/
public function processEndpoint()
{
//App::import('Vendor', 'hybridauth/Hybrid/Endpoint');
require_once ROOT . DS . 'vendor' . DS . 'hybridauth' . DS . 'hybridauth' . DS . 'hybridauth' . DS . 'Hybrid' . DS . 'Endpoint.php';
if (!$this->hybridauth) {
$this->init();
}
\Hybrid_Endpoint::process();
}
示例8: getAuth
public function getAuth()
{
try {
\Hybrid_Endpoint::process();
} catch (\Exception $e) {
// redirect back to http://URL/social/
//return Redirect::to('social');
}
return;
}
示例9: hybrid
public function hybrid($provider)
{
if (isset($_REQUEST['hauth_start']) || isset($_REQUEST['hauth_done'])) {
\Hybrid_Endpoint::process();
}
try {
// create an instance for Hybridauth with the configuration file path as parameter
// try to authenticate the user with twitter,
// user will be redirected to Twitter for authentication,
// if he already did, then Hybridauth will ignore this step and return an instance of the adapter
$this->provider = $this->hybrid_auth->authenticate(ucfirst($provider));
var_dump($this->provider);
die;
// get the user profile
$twitter_user_profile = $this->provider->getUserProfile();
var_dump($twitter_user_profile);
die;
$this->session->set('auth-identity', array('id' => $twitter_user_profile->identifier, 'username' => $twitter_user_profile->displayName, 'pic' => $twitter_user_profile->photoURL));
//return $this->response->redirect('');
} catch (\Exception $e) {
// Display the recived error,
// to know more please refer to Exceptions handling section on the userguide
switch ($e->getCode()) {
case 0:
echo "Unspecified error.";
break;
case 1:
echo "Hybriauth configuration error.";
break;
case 2:
echo "Provider not properly configured.";
break;
case 3:
echo "Unknown or disabled provider.";
break;
case 4:
echo "Missing provider application credentials.";
break;
case 5:
echo "Authentification failed. The user has canceled the authentication or the provider refused the connection.";
break;
case 6:
echo "User profile request failed. Most likely the user is not connected to the provider and he should authenticate again.";
$this->provider->logout();
break;
case 7:
echo "User not connected to the provider.";
$this->provider->logout();
break;
case 8:
echo "Provider does not support this feature.";
break;
}
}
}
示例10: login
public function login($account)
{
if (isset($_REQUEST['hauth_start']) || isset($_REQUEST['hauth_done'])) {
Hybrid_Endpoint::process();
}
$authAdapter = $this->service->authenticate($account);
if ($authAdapter) {
return $this->user->login($authAdapter->getUserProfile()->email);
}
return null;
}
示例11: login
public function login(\Hybrid_Auth $hybridAuth, $action = '')
{
try {
switch ($action) {
case 'auth':
\Hybrid_Endpoint::process();
return;
case 'openid-google':
$hybridAuthProvider = $hybridAuth->authenticate('openid', ['openid_identifier' => 'http://www.google.com/accounts/o8/id']);
$hybridAuthUserProfile = $hybridAuthProvider->getUserProfile();
$user = User::firstOrCreate(['authenticator' => 'openid', 'authenticator_credential' => $hybridAuthUserProfile->identifier]);
break;
case 'openid-yahoo':
$hybridAuthProvider = $hybridAuth->authenticate('openid', ['openid_identifier' => 'http://my.yahoo.com']);
$hybridAuthUserProfile = $hybridAuthProvider->getUserProfile();
$user = User::firstOrCreate(['authenticator' => 'openid', 'authenticator_credential' => $hybridAuthUserProfile->identifier]);
break;
case 'google':
$hybridAuthProvider = $hybridAuth->authenticate('google');
$hybridAuthUserProfile = $hybridAuthProvider->getUserProfile();
$user = User::firstOrCreate(['authenticator' => 'openid', 'authenticator_credential' => $hybridAuthUserProfile->identifier]);
break;
case 'facebook':
$hybridAuthProvider = $hybridAuth->authenticate('facebook');
$hybridAuthUserProfile = $hybridAuthProvider->getUserProfile();
$user = User::firstOrCreate(['authenticator' => 'facebook', 'authenticator_credential' => $hybridAuthUserProfile->identifier]);
break;
case 'twitter':
$hybridAuthProvider = $hybridAuth->authenticate('twitter');
$hybridAuthUserProfile = $hybridAuthProvider->getUserProfile();
$user = User::firstOrCreate(['authenticator' => 'twitter', 'authenticator_credential' => $hybridAuthUserProfile->identifier]);
break;
default:
$hybridAuthProvider = $hybridAuth->authenticate('openid', ['openid_identifier' => $action]);
$hybridAuthUserProfile = $hybridAuthProvider->getUserProfile();
$user = User::firstOrCreate(['authenticator' => 'openid', 'authenticator_credential' => $hybridAuthUserProfile->identifier]);
break;
}
\Session::put('userid', $user->id);
// TODO: Return to the index page
} catch (Exception $ex) {
// TODO: Return error to the login form
}
}
示例12: getLoginFacebook
public function getLoginFacebook($auth = NULL)
{
if ($auth == 'auth') {
try {
\Hybrid_Endpoint::process();
} catch (Exception $e) {
return Redirect::to("home");
}
return;
}
$config = array("base_url" => "http://laravel/public/", "providers" => array("Facebook" => array("enabled" => true, "keys" => array("id" => "488919314589569", "secret" => "2b8ab46fece7bef72c48abe0eaa664d0"), "scope" => "public_profile,email", "display" => "popup")));
$oauth = new \Hybrid_Auth($config);
$provider = $oauth->authenticate("Facebook");
$profile = $provider->getUserProfile();
var_dump($profile);
echo "FirstName:" . $profile->firstName . "<br>";
echo "Email:" . $profile->email;
echo "<br><a href='logout'>Logout</a> ";
}
示例13: hybridlogin
/**
* Login using hybrid auth.
*/
function hybridlogin($provider)
{
if (isset($_REQUEST['hauth_start']) || isset($_REQUEST['hauth_done'])) {
Hybrid_Endpoint::process();
exit;
}
$config = array("base_url" => RewriteUtil::getBaseUrl() . "main/hybridlogin?provider=" . $provider, "providers" => array());
if (isset($this->config["facebookAppId"])) {
$config["providers"]["Facebook"] = array("enabled" => true, "trustForwarded" => false, "scope" => "email", "keys" => array("id" => $this->config["facebookAppId"], "secret" => $this->config["facebookSecret"]));
}
$hybridauth = new Hybrid_Auth($config);
try {
$auth = $hybridauth->authenticate($provider);
$profile = $auth->getUserProfile();
$_SESSION["email"] = $profile->email;
$this->redirect();
} catch (Exception $e) {
$this->showLoginForm($e->getMessage());
}
}
示例14: process
public static function process($request = NULL)
{
// Setup request variable
Hybrid_Endpoint::$request = $request;
if (is_null(Hybrid_Endpoint::$request)) {
// Fix a strange behavior when some provider call back ha endpoint
// with /index.php?hauth.done={provider}?{args}...
// >here we need to recreate the $_REQUEST
if (strrpos($_SERVER["QUERY_STRING"], '?')) {
$_SERVER["QUERY_STRING"] = str_replace("?", "&", $_SERVER["QUERY_STRING"]);
parse_str($_SERVER["QUERY_STRING"], $_REQUEST);
}
Hybrid_Endpoint::$request = $_REQUEST;
}
// If we get a hauth.start
if (isset(WSL_Hybrid_Endpoint::$request["hauth_start"]) && WSL_Hybrid_Endpoint::$request["hauth_start"]) {
return WSL_Hybrid_Endpoint::processAuthStart();
} elseif (isset(WSL_Hybrid_Endpoint::$request["hauth_done"]) && WSL_Hybrid_Endpoint::$request["hauth_done"]) {
return WSL_Hybrid_Endpoint::processAuthDone();
}
parent::process($request);
}
示例15:
<?php
/*!
* HybridAuth
* http://hybridauth.sourceforge.net | https://github.com/hybridauth/hybridauth
* (c) 2009-2011 HybridAuth authors | hybridauth.sourceforge.net/licenses.html
*/
// ------------------------------------------------------------------------
// HybridAuth End Point
// ------------------------------------------------------------------------
require_once "Hybrid/Auth.php";
require_once "Hybrid/Endpoint.php";
Hybrid_Endpoint::process();