/**
  * get_opauth_config
  * @param array Any extra overrides
  * @return array Config for use with Opauth
  */
 public static function get_opauth_config($mergeConfig = array())
 {
     $config = self::config();
     return array_merge(array('path' => OpauthController::get_path(), 'callback_url' => OpauthController::get_callback_path()), $config->opauth_settings, $mergeConfig);
 }
コード例 #2
0
 /**
  * Global endpoint for handleStrategy - all strategy actions point here.
  * @throws LogicException This should not be directly called.
  * @throws InvalidArgumentException The strategy must be valid and existent
  * @param string $funcName The bound function name from addWrapperMethod
  * @param array $data Standard data param as part of form submission
  * @param OpauthLoginForm $form
  * @param SS_HTTPRequest $request
  * @return ViewableData
  */
 public function handleStrategy($funcName, $data, $form, $request)
 {
     if (func_num_args() < 4) {
         throw new LogicException('Must be called with a strategy handler');
     }
     // Trim handleStrategy from the function name:
     $strategy = substr($funcName, strlen('handleStrategy')) . 'Strategy';
     // Check the strategy is good
     if (!class_exists($strategy) || $strategy instanceof OpauthStrategy) {
         throw new InvalidArgumentException('Opauth strategy ' . $strategy . ' was not found or is not a valid strategy');
     }
     return $this->controller->redirect(Controller::join_links(OpauthController::get_path(), OpauthAuthenticator::get_strategy_segment($strategy)));
 }