本文整理汇总了PHP中HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner::configureOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP GenericOAuth2ResourceOwner::configureOptions方法的具体用法?PHP GenericOAuth2ResourceOwner::configureOptions怎么用?PHP GenericOAuth2ResourceOwner::configureOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner
的用法示例。
在下文中一共展示了GenericOAuth2ResourceOwner::configureOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => '{base_url}/oauth2/authorize', 'access_token_url' => '{base_url}/oauth2/token', 'revoke_token_url' => '{base_url}/oauth2/revoke', 'infos_url' => '{base_url}/user'));
$resolver->setRequired(array('base_url'));
$normalizer = function (Options $options, $value) {
return str_replace('{base_url}', $options['base_url'], $value);
};
$resolver->setNormalizers(array('authorization_url' => $normalizer, 'access_token_url' => $normalizer, 'revoke_token_url' => $normalizer, 'infos_url' => $normalizer));
}
示例2: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://accounts.google.com/o/oauth2/auth', 'access_token_url' => 'https://accounts.google.com/o/oauth2/token', 'revoke_token_url' => 'https://accounts.google.com/o/oauth2/revoke', 'infos_url' => 'https://www.googleapis.com/oauth2/v1/userinfo', 'scope' => 'https://www.googleapis.com/auth/userinfo.profile', 'access_type' => null, 'approval_prompt' => null, 'display' => null, 'hd' => null, 'login_hint' => null, 'prompt' => null, 'request_visible_actions' => null));
if (method_exists($resolver, 'setDefined')) {
$resolver->setAllowedValues('access_type', array('online', 'offline', null))->setAllowedValues('approval_prompt', array('force', 'auto', null))->setAllowedValues('display', array('page', 'popup', 'touch', 'wap', null))->setAllowedValues('login_hint', array('email address', 'sub', null))->setAllowedValues('prompt', array('consent', 'select_account', null));
} else {
$resolver->setAllowedValues(array('access_type' => array('online', 'offline', null), 'approval_prompt' => array('force', 'auto', null), 'display' => array('page', 'popup', 'touch', 'wap', null), 'login_hint' => array('email address', 'sub', null), 'prompt' => array('consent', 'select_account', null)));
}
}
示例3: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setRequired('base_url');
$resolver->setDefaults(array('authorization_url' => '{base_url}/admin/oauth/authorize', 'access_token_url' => '{base_url}/admin/oauth/access_token', 'infos_url' => '{base_url}/admin/shop.json', 'use_bearer_authorization' => false));
$baseUrlNormalizer = function (Options $options, $value) {
return strtr($value, ['{base_url}' => $options['base_url']]);
};
$resolver->setNormalizers(['authorization_url' => $baseUrlNormalizer, 'access_token_url' => $baseUrlNormalizer, 'infos_url' => $baseUrlNormalizer]);
}
示例4: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://www.facebook.com/v2.0/dialog/oauth', 'access_token_url' => 'https://graph.facebook.com/v2.0/oauth/access_token', 'revoke_token_url' => 'https://graph.facebook.com/v2.0/me/permissions', 'infos_url' => 'https://graph.facebook.com/v2.0/me', 'use_commas_in_scope' => true, 'display' => null, 'auth_type' => null, 'appsecret_proof' => false));
// Symfony <2.6 BC
if (method_exists($resolver, 'setDefined')) {
$resolver->setAllowedValues('display', array('page', 'popup', 'touch', null))->setAllowedValues('auth_type', array('rerequest', null))->setAllowedTypes('appsecret_proof', 'bool');
} else {
$resolver->setAllowedValues(array('display' => array('page', 'popup', 'touch', null), 'auth_type' => array('rerequest', null), 'appsecret_proof' => array(true, false)));
}
}
示例5: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://accounts.google.com/o/oauth2/auth', 'access_token_url' => 'https://accounts.google.com/o/oauth2/token', 'revoke_token_url' => 'https://accounts.google.com/o/oauth2/revoke', 'infos_url' => 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet&mine=true', 'scope' => 'https://www.googleapis.com/auth/youtube.readonly', 'access_type' => null, 'approval_prompt' => null, 'display' => null, 'hd' => null, 'login_hint' => null, 'prompt' => null, 'request_visible_actions' => null));
// Symfony <2.6 BC
if (method_exists($resolver, 'setDefined')) {
$resolver->setAllowedValues('access_type', array('online', 'offline', null))->setAllowedValues('approval_prompt', array('force', 'auto', null))->setAllowedValues('display', array('page', 'popup', 'touch', 'wap', null))->setAllowedValues('login_hint', array('email address', 'sub', null))->setAllowedValues('prompt', array(null, 'consent', 'select_account', null));
} else {
$resolver->setAllowedValues(array('access_type' => array('online', 'offline', null), 'approval_prompt' => array('force', 'auto', null), 'display' => array('page', 'popup', 'touch', 'wap', null), 'login_hint' => array('email address', 'sub', null), 'prompt' => array(null, 'consent', 'select_account', null)));
}
}
示例6: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://oauth.vk.com/authorize', 'access_token_url' => 'https://oauth.vk.com/access_token', 'infos_url' => 'https://api.vk.com/method/users.get', 'use_commas_in_scope' => true, 'fields' => 'nickname,photo_50', 'name_case' => null));
$resolver->setNormalizers(array('fields' => function (Options $options, $value) {
if (!$value) {
return null;
}
return is_array($value) ? implode(',', $value) : $value;
}));
}
示例7: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://api.dailymotion.com/oauth/authorize', 'access_token_url' => 'https://api.dailymotion.com/oauth/token', 'infos_url' => 'https://api.dailymotion.com/me', 'display' => null));
if (method_exists($resolver, 'setDefined')) {
// @link http://www.dailymotion.com/doc/api/authentication.html#dialog-form-factors
$resolver->setAllowedValues('display', array('page', 'popup', 'mobile', null));
} else {
$resolver->setAllowedValues(array('display' => array('page', 'popup', 'mobile', null)));
}
}
示例8: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('sandbox' => false, 'scope' => 'openid email', 'authorization_url' => 'https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize', 'access_token_url' => 'https://api.paypal.com/v1/identity/openidconnect/tokenservice', 'infos_url' => 'https://api.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid'));
$resolver->addAllowedTypes(array('sandbox' => 'bool'));
$sandboxTransformation = function (Options $options, $value) {
if (!$options['sandbox']) {
return $value;
}
return preg_replace('~\\.paypal\\.~', '.sandbox.paypal.', $value, 1);
};
$resolver->setNormalizers(array('authorization_url' => $sandboxTransformation, 'access_token_url' => $sandboxTransformation, 'infos_url' => $sandboxTransformation));
}
示例9: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => '{base_url}/authorize', 'access_token_url' => '{base_url}/oauth/token', 'infos_url' => '{base_url}/userinfo'));
$resolver->setRequired(array('base_url'));
$normalizer = function (Options $options, $value) {
return str_replace('{base_url}', $options['base_url'], $value);
};
// Symfony <2.6 BC
if (method_exists($resolver, 'setNormalizer')) {
$resolver->setNormalizer('authorization_url', $normalizer)->setNormalizer('access_token_url', $normalizer)->setNormalizer('infos_url', $normalizer);
} else {
$resolver->setNormalizers(array('authorization_url' => $normalizer, 'access_token_url' => $normalizer, 'infos_url' => $normalizer));
}
}
示例10: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://oauth.vk.com/authorize', 'access_token_url' => 'https://oauth.vk.com/access_token', 'infos_url' => 'https://api.vk.com/method/users.get', 'scope' => 'email', 'use_commas_in_scope' => true, 'fields' => 'nickname,photo_medium,screen_name,email', 'name_case' => null));
$fieldsNormalizer = function (Options $options, $value) {
if (!$value) {
return null;
}
return is_array($value) ? implode(',', $value) : $value;
};
// Symfony <2.6 BC
if (method_exists($resolver, 'setNormalizer')) {
$resolver->setNormalizer('fields', $fieldsNormalizer);
} else {
$resolver->setNormalizers(array('fields' => $fieldsNormalizer));
}
}
示例11: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('sandbox' => false, 'authorization_url' => 'https://login.salesforce.com/services/oauth2/authorize', 'access_token_url' => 'https://login.salesforce.com/services/oauth2/token', 'infos_url' => null, 'format' => 'json'));
$sandboxTransformation = function (Options $options, $value) {
if (!$options['sandbox']) {
return $value;
}
return preg_replace('~login\\.~', 'test.', $value, 1);
};
// Symfony <2.6 BC
if (method_exists($resolver, 'setNormalizer')) {
$resolver->setNormalizer('authorization_url', $sandboxTransformation)->setNormalizer('access_token_url', $sandboxTransformation);
$resolver->addAllowedTypes('sandbox', 'bool');
} else {
$resolver->setNormalizers(array('authorization_url' => $sandboxTransformation, 'access_token_url' => $sandboxTransformation));
$resolver->addAllowedTypes(array('sandbox' => 'bool'));
}
}
示例12: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array(
'authorization_url' => 'https://www.facebook.com/dialog/oauth',
'access_token_url' => 'https://graph.facebook.com/oauth/access_token',
'revoke_token_url' => 'https://graph.facebook.com/me/permissions',
'infos_url' => 'https://graph.facebook.com/me',
'use_commas_in_scope' => true,
'display' => null,
));
$resolver->setAllowedValues(array(
// @link https://developers.facebook.com/docs/reference/dialogs/#display
'display' => array('page', 'popup', 'touch'),
));
}
示例13: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://www.box.com/api/oauth2/authorize', 'access_token_url' => 'https://www.box.com/api/oauth2/token', 'revoke_token_url' => 'https://www.box.com/api/oauth2/revoke', 'infos_url' => 'https://api.box.com/2.0/users/me'));
}
示例14: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolverInterface $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'http://www.odnoklassniki.ru/oauth/authorize', 'access_token_url' => 'http://api.odnoklassniki.ru/oauth/token.do', 'infos_url' => 'http://api.odnoklassniki.ru/fb.do?method=users.getCurrentUser', 'application_key' => null));
}
示例15: configureOptions
/**
* {@inheritDoc}
*/
protected function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('authorization_url' => 'https://login.live.com/oauth20_authorize.srf', 'access_token_url' => 'https://login.live.com/oauth20_token.srf', 'infos_url' => 'https://apis.live.net/v5.0/me'));
}