auth service callback
@param Base $f3
@param $params
432259
function callback(\Base $f3, $params) {
		$Opauth = new \Opauth($this->config,false);
		switch ($Opauth->env['callback_transport']) {
			case 'session':
				$response = $f3->get('SESSION.opauth');
				$f3->clear('SESSION.opauth');
				break;
			case 'post':
				$response = unserialize(base64_decode($f3->get('POST.opauth')));
				break;
			case 'get':
				$response = unserialize(base64_decode($f3->get('GET.opauth')));
				break;
			default:
				$f3->error(400,'Unsupported callback_transport');
				break;
		}
		if (isset($response['error'])) {
			$f3->call($this->abortFunc,array($response));
			return;
		}
		$data = $response['auth'];
		// validate
		if (empty($data) || empty($response['timestamp']) || empty($response['signature'])
			|| empty($data['provider']) || empty($data['uid']))
			$f3->error(400,'Invalid auth response: Missing key auth response components');
		elseif (!$Opauth->validate(sha1(print_r($data, true)),
			$response['timestamp'], $response['signature'], $reason))
			$f3->error(400,'Invalid auth response: '.$reason);
		else
			// It's all good
			$f3->call($this->successFunc,array($data));
	}
477299
public static function on( $param1, $param2 = null, $param3 = null ) 
	{	
		// call contains options
		if ( !is_null( $param3 ) && !is_callable( $param2 ) ) 
		{
			// if the param2 is a string we going to use it as alias
			if ( is_string( $param2 ) ) 
			{
				static::alias( $param2, $param1 );
			}
			elseif ( is_array( $param2 ) ) 
			{
				// assign alias
				if ( array_key_exists( 'alias', $param2 ) ) 
				{
					static::alias( $param2['alias'], $param1 );
				}
				// asign wake event
				if ( array_key_exists( 'wake', $param2 ) ) 
				{
					static::event( 'wake', $param1, $param2['wake'] );
				}
				// assign sleep event
				if ( array_key_exists( 'sleep', $param2 ) ) 
				{
					static::event( 'sleep', $param1, $param2['sleep'] );
				}
			}
			
			$param2 = $param3; unset( $param3 );
		}
		
		if ( !is_array( $param1 ) ) 
		{
			$param1 = array( $param1 => $param2 );
		}
		
		static::prepare( $param1 );
	}
1298276
public function call($functionname, $params) {
        if ($this->token) {
            $this->serverurl->param('wstoken', $this->token);
        }
        $this->serverurl->param('wsdl', 1);

        $opts = array(
            'http' => array(
                'user_agent' => 'Moodle SOAP Client'
            )
        );
        $context = stream_context_create($opts);
        $this->options['stream_context'] = $context;
        $this->options['cache_wsdl'] = WSDL_CACHE_NONE;

        $client = new SoapClient($this->serverurl->out(false), $this->options);

        return $client->__soapCall($functionname, $params);
    }
814422
protected function ensureAccess($params = [])
    {
        if (!isset($this->checkAccess))
            return;

        $params['action'] = $this;

        if (call_user_func($this->checkAccess, $params))
            return;

        $user = \Yii::$app->user;

        if ($user->getIsGuest())
            $user->loginRequired();
        else
            throw new ForbiddenHttpException(\Yii::t(
                Constants::MSG_CATEGORY_NAME,
                'You are not allowed to perform this action.'
            ));

    }
1062208
public static function authorizeUrl($params = null, $opts = null)
    {
        $params = $params ?: [];

        $base = ($opts && array_key_exists('connect_base', $opts)) ? $opts['connect_base'] : Stripe::$connectBase;

        $params['client_id'] = self::_getClientId($params);
        if (!array_key_exists('response_type', $params)) {
            $params['response_type'] = 'code';
        }
        $query = Util\Util::encodeParameters($params);

        return $base . '/oauth/authorize?' . $query;
    }
723524
public function callbackAction($callbackUri) {
		try {
			$this->authenticationManager->authenticate();
		} catch (\TYPO3\Flow\Security\Exception\AuthenticationRequiredException $exception) {
			$authenticationException = $exception;
		}

		if ($this->authenticationManager->isAuthenticated()) {
			$storedRequest = $this->securityContext->getInterceptedRequest();
			if ($storedRequest !== NULL) {
				$this->securityContext->setInterceptedRequest(NULL);
				$this->redirectToRequest($storedRequest);
			} else {
				// TODO Do we have to check the URI?
				$this->redirectToUri($callbackUri);
			}
		} else {
			throw new \Flowpack\SingleSignOn\Client\Exception('Could not authenticate in callbackAction triggered by the SSO server.', 1366613161, (isset($authenticationException) ? $authenticationException : NULL));
		}
	}
49339
public function buildAuthUrl(array $params = [])
    {
        $defaultParams = [
            'client_id' => $this->clientId,
            'response_type' => 'code',
            'redirect_uri' => $this->getReturnUrl(),
            'xoauth_displayname' => Yii::$app->name,
            'state' => $this->state,
            'duration' => $this->duration,
        ];
        if (!empty($this->scope)) {
            $defaultParams['scope'] = $this->scope;
        }

        return $this->composeUrl($this->authUrl, array_merge($defaultParams, $params));
    }
723459
private function setAuthentication($key, $secret, $call, $settings)
    {
        $isBasicAuth = $this->isBasicAuthentication($key, $secret);
        if ($isBasicAuth) {
            $this->apikey = $key;
            $this->apisecret = $secret;
        } else {
            $this->apitoken = $key;
            $this->version = Config::SMS_VERSION;
        }
        $this->initSettings($call, $settings);
        $this->setSettings();
    }
1190435
public static function logout($params = "")
    {
        phpCAS :: traceBegin();
        phpCAS::_validateClientExists();

        $parsedParams = array ();
        if ($params != "") {
            if (is_string($params)) {
                phpCAS :: error('method `phpCAS::logout($url)\' is now deprecated, use `phpCAS::logoutWithUrl($url)\' instead');
            }
            if (!is_array($params)) {
                phpCAS :: error('type mismatched for parameter $params (should be `array\')');
            }
            foreach ($params as $key => $value) {
                if ($key != "service" && $key != "url") {
                    phpCAS :: error('only `url\' and `service\' parameters are allowed for method `phpCAS::logout($params)\'');
                }
                $parsedParams[$key] = $value;
            }
        }
        self::$_PHPCAS_CLIENT->logout($parsedParams);
        // never reached
        phpCAS :: traceEnd();
    }
358863
function buildFunctionParams( &$params )
    {
        foreach( array_keys( $params ) as $paramKey )
        {
            if( $this->isFunctionParam( $params[$paramKey] ) )
            {
                $params[$paramKey] = $this->execFunction( $params[$paramKey] );
            }
            else if( is_array( $params[$paramKey] ) )
            {
                $this->buildFunctionParams( $params[$paramKey] );
            }
        }
    }
876862
public function callback() {
		$timestamp = date('c');

		// To standardize the way of accessing data, objects are translated to arrays
		$this->auth = $this->recursiveGetObjectVars($this->auth);

		$this->auth['provider'] = $this->strategy['strategy_name'];

		$params = array(
			'auth' => $this->auth,
			'timestamp' => $timestamp,
			'signature' => $this->sign($timestamp)
		);

		$this->shipToCallback($params);
	}
453860
public function logout( $params,
                            ManagerInterface            $sessionManager,
                            ZendAuthenticationService   $auth = null )
    {
        if ( null === $auth )
        {
            $auth = $this->getAuthenticationService();
        }

        if ( $params instanceof Traversable )
        {
            $params = ArrayUtils::iteratorToArray( $params );
        }

        $event = new Event( Event::EVENT_LOGOUT, $auth, $params );
        $event->setAuthenticationService( $auth )
              ->setSessionManager( $sessionManager );

        $this->getEventManager()
             ->trigger( $event );

        return $event->getParams();
    }
33766
final public function HTTPAuthenticate(
		$mode         = 'Basic',
		array $params = array()
	)
	{
		if (is_string($mode)) {
			$mode = ucwords(strtolower($mode));
		}
		if (! (is_string($mode) and in_array($mode, array('Basic', 'Digest')))) {
			$mode = 'Basic';
		}
		$params = array_filter($params, 'is_string');
		$params = array_merge(array('realm' => $_SERVER['HTTP_HOST']), $params);
		header(sprintf(
			'WWW-Authenticate: %s %s',
			$mode,
			join(', ', array_map(
				function($key, $val)
				{
					return $key . '="' . trim($val, '"') . '"';
				},
				array_keys($params),
				array_values($params)
			))
		));
		http_response_code(401);
	}
496010
protected function composeAuthorizationHeader(array $params, $realm = '')
    {
        $header = 'OAuth';
        $headerParams = [];
        if (!empty($realm)) {
            $headerParams[] = 'realm="' . rawurlencode($realm) . '"';
        }
        foreach ($params as $key => $value) {
            if (substr_compare($key, 'oauth', 0, 5)) {
                continue;
            }
            $headerParams[] = rawurlencode($key) . '="' . rawurlencode($value) . '"';
        }
        if (!empty($headerParams)) {
            $header .= ' ' . implode(', ', $headerParams);
        }

        return ['Authorization' => $header];
    }
1254850
private static function _getConnectParam($paramName, $params = null)
    {
        $oauthParam = ($params && array_key_exists($paramName, $params))
        ? $params[$paramName] : null;

        if ($oauthParam === null) {
            $funcName = 'get' . Util\Util::toCamelCase($paramName, true);
            $oauthParam = Sumup::{$funcName}();
        }

        if ($oauthParam === null) {
            $msg = 'No '.$paramName.' provided. You can find your '. $paramName
            . ' in your Sumup dashboard at '
            . 'https://me.sumup.com/developers, '
            . 'after registering your account as a platform. See '
            . 'https://sumupus.desk.com/ for details, '
            . 'or email support@sumup.com if you have any questions.';
            throw new Error\AuthenticationError($msg);
        }

        return $oauthParam;
    }
252961
public function call($name, array $params = [])
    {
        $this->checkName($name);

        array_unshift($params, $this);
        call_user_func_array($this->callbacks[$name], $params);

        return $this;
    }
564744
public function auth(callable $fn, $retried = false)
    {
        // 1. 获取Access token
        $token = $this->getAccessTokenByAuth();
        if (!$token) {
            $this->code = -1;
            $this->message = '很抱歉,网络繁忙,请再试一次';

            return false;
        }

        // 2. 调用接口,转换异常为错误信息
        try {
            /** @var Http $http */
            $http = $fn();
        } catch (\Exception $e) {
            $this->code = -abs($e->getCode());
            $this->message = $e->getMessage();

            $http = \Miaoxing\App\Callback\Http::$lastErrorHttp;
            if ($http) {
                $this->logApi($http);
            }

            return false;
        }

        // 3. 成功直接返回
        if (!$this->isError($http)) {
            $this->code = 1;
            $this->message = '操作成功';

            return $http;
        }

        // 4. 处理接口返回错误
        // 如果是Access token无效或过期,清除缓存数据,然后重试一次
        if ($http['errcode'] == 40001 || $http['errcode'] == 42001) {
            $this->removeAccessTokenByAuth();
            if (!$retried) {
                $this->statsD->increment('wechat.credentialInvalid');

                return $this->auth($fn, true);
            }
        }
        $credential = $this->cache->get($this->getAccessTokenCacheKey());

        return $this->prepareError($http, $credential);
    }