生成outh URL

@param string $to
@param string $scope
@param string $state

@return string
331474
public function url($to = null, $scope = 'snsapi_userinfo', $state = 'STATE')
    {
        $to !== null || $to = Url::current();

        $queryStr = [
            'appid'         => $this->getAppId(),
            'redirect_uri'  => $to,
            'response_type' => 'code',
            'scope'         => $scope,
            'state'         => $state,
        ];

        return self::API_URL . '?' . http_build_query($queryStr) . '#wechat_redirect';
    }
1325851
public function to($scope)
    {
        if (isset($this->paths[$scope])) {
            return $this->paths[$scope];
        }

        throw new OutOfBoundsException("Path of '$scope' was not mapped");
    }
974358
protected function getAuthUrl($state)
    {
        // 网页授权登录
        if (!empty($this->scopes)) {
            return $this->getOAuthUrl($state);
        }

        // 第三方网页应用登录（扫码登录）
        return $this->getQrConnectUrl($state);
    }
1108179
final public function url($module, $controller = null, $action = null, array $params = array(), $hash = null) {
        $module = ucfirst(Util::hyphenToCamel($module));
        $moduleOptions = engineGet('config', 'modules', $module, false);
        $module = (isset($moduleOptions['alias'])) ? $moduleOptions['alias'] : $module;

        $return = Util::camelToHyphen($module);
        if ($controller)
            $return .= '/' . Util::camelToHyphen($controller);
        if ($action)
            $return .= '/' . Util::camelToHyphen($action);
        if (!empty($params))
            $return .= str_replace('//', '/' . urlencode(' ') . '/', '/' . join('/', $this->encodeParams($params)));
        if ($hash)
            $return .= '#' . $hash;

        return engineGet('serverPath') . $return;
    }
181543
protected function urlRoute($module, $controller, $params): string
    {
        $url = $this->getBaseUrl();

        if (empty($params) && $controller === self::DEFAULT_CONTROLLER) {
            if ($module === self::DEFAULT_MODULE) {
                return $url;
            }
            return $url . $module;
        }

        $url .= $module . '/' . $controller;
        $getParams = [];
        foreach ($params as $key => $value) {
            // sub-array as GET params
            if (\is_array($value)) {
                $getParams[$key] = $value;
                continue;
            }
            $url .= '/' . urlencode((string)$key) . '/' . urlencode((string)$value);
        }
        if (!empty($getParams)) {
            $url .= '?' . http_build_query($getParams);
        }
        return $url;
    }
158429
private function getStateURL($page, array $state) {
		assert('is_string($page)');

		$stateId = SimpleSAML_Auth_State::saveState($state, 'openidProvider:resumeState');
		$stateURL = SimpleSAML\Module::getModuleURL('openidProvider/' . $page);
		$stateURL = \SimpleSAML\Utils\HTTP::addURLParameters($stateURL, array('StateID' => $stateId));

		return $stateURL;
	}
842362
protected function redirectWithCode($client_id,
                                        Uri $redirect_uri,
                                        $scope = null,
                                        $state = null) {
        $model = new OAuthAuthorizationCodeModel();
        $model->client_id = $client_id;
        $model->redirect_uri = (string)$redirect_uri;
        $model->user_id = auth()->id();
        $model->scope = $scope;
        $model->authorization_code = $model->generateCode();
        $model->expires = Time::timestamp(time() + 3600);
        $model->save();
        OAuthClientUserModel::create([
            'client_id' => $client_id,
            'user_id' => auth()->id()
        ]);
        return $this->redirect($redirect_uri->addData([
            'code' => $model->authorization_code,
            'state' => $state
        ]));
    }
1020404
public function exportUrl($scope = 1, $args = null)
    {
        $input = array_merge(Input::all(), Exporter::formatExportQuery($scope, $args));

        return $this->resource().'?'.http_build_query($input);
    }
787503
function OutCtrl($scope, $location, $rootScope, $window, $timeout, $routeParams,
                 _bind, _modules, _req, _socket) {

  /****************************************************************************/
  /* INITIALIZATION                                                           */
  /****************************************************************************/
  /* Handhsaking */
  _socket.emit('tail', $routeParams.name);

  _socket.on('module', function(module) {
    $scope.module = module;
    $window.document.title = 'out::' + module.name;
  });

  $scope.data = '';
  _socket.on('chunk', function(chunk) {
    /* The same socket may receive events from multiple modules. */
    if($scope.module.name === chunk.module) {
      $scope.data += chunk.data;
    }
    /* Basically the socket stays open. TODO(spolu): FixMe */
    if($timeout && $('.wrapper') && $('.wrapper')[0]) {
      $timeout(function() {
        $('.wrapper').scrollTop($('.wrapper')[0].scrollHeight);
      });
    }
  });

  /****************************************************************************/
  /* COMMANDS                                                                  */
  /****************************************************************************/

  $scope.modules_restart = function(path) {
    /* On restart we clear the log buffer. */
    $scope.data = '';
    async.series([
      function(cb_) {
        _modules.kill(path).then(function(data) {
          return cb_();
        });
      },
      function(cb_) {
        _modules.run(path).then(function(data) {
          return cb_();
        });
      },
    ], function(err) {
    });
  };
}
1346663
public function getAuthUrl($callbackUrl = null, $state = null, $scope = null)
	{
		$option = array(
			'client_id'			=>	$this->appid,
			'redirect_uri'		=>	null === $callbackUrl ? $this->callbackUrl : $callbackUrl,
			'scope'				=>	null === $scope ? $this->scope : $scope,
			'state'				=>	$this->getState($state),
			'allow_signup'		=>	$this->allowSignup,
		);
		if(null === $this->loginAgentUrl)
		{
			return $this->getAuthLoginUrl('login/oauth/authorize', $option);
		}
		else
		{
			return $this->loginAgentUrl . '?' . $this->http_build_query($option);
		}
	}
191649
function getLoginUrl($state) {
        $loginUrl = "https://accounts.google.com/o/oauth2/auth?"
            . "client_id=" . $this->client_id
            . "&redirect_uri=" . $this->redirect
            . "&state=" . $state
            . "&response_type=code"
            . "&scope=email%20profile" 
            . "&include_granted_scopes=true";

        if ( $this->openid_realm ) {
            $loginUrl .= "&openid.realm=" . $this->openid_realm;
        }
        return $loginUrl;
    }
783693
public function to($to)
    {
        $root    = $this->root();
        $to      = trim($to, '/');
        $pattern = trim("{$root}/{$to}", '/');

        return $pattern !== '/' ? $pattern : '';
    }
964453
protected function generateLoginUrl($query)
    {
        //if there is a scope
        if (!is_null($this->scope)) {
            //if scope is in array
            if (is_array($this->scope)) {
                $this->scope = implode(' ', $this->scope);
            }
            //add scope to the query
            $query['scope'] = $this->scope;
        }
        //if there is state
        if (!is_null($this->state)) {
            //add state to the query
            $query['state'] = $this->state;
        }
        //if there is display
        if (!is_null($this->display)) {
            //add state to the query
            $query['display'] = $this->display;
        }
        //generate a login url
        return $this->requestUrl.'?'.http_build_query($query);
    }
783072
function(state) {
      return state.url ? state : (state.parent ? state.parent.navigable : null);
    }
417401
public function getOauthRedirect($callback,$state='',$scope='snsapi_userinfo'){
        return self::OAUTH_PREFIX.self::OAUTH_AUTHORIZE_URL.'appid='.$this->appid.'&redirect_uri='.urlencode($callback).'&response_type=code&scope='.$scope.'&state='.$state.'#wechat_redirect';
    }
1146054
public String getOauthPageUrl(String redirectUrl, OauthScope scope, String state) {
        BeanUtil.requireNonNull(redirectUrl, "redirectUrl is null");
        BeanUtil.requireNonNull(scope, "scope is null");
        String userState = StrUtil.isBlank(state) ? "STATE" : state;
        String url = null;
        try {
            url = URLEncoder.encode(redirectUrl, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            LOG.error("异常", e);
        }
        StringBuilder stringBuilder = new StringBuilder("https://open.weixin.qq.com/connect/oauth2/authorize?");
        stringBuilder.append("appid=").append(this.config.getAppid())
                .append("&redirect_uri=").append(url)
                .append("&response_type=code&scope=").append(scope.toString())
                .append("&state=")
                .append(userState)
                .append("#wechat_redirect");
        return stringBuilder.toString();
    }
599636
function configAdminRoute($urlRouterProvider, $stateProvider) {
    var adminState = {
      name: 'admin',
      url: '/admin',
      abstract: true,
      templateUrl: 'app/admin/admin.html',
      controller: 'AdminController',
      controllerAs: 'vm'
    };

    $urlRouterProvider.when('/admin', '/admin/');
    $stateProvider.state(adminState);
  }