本文整理汇总了Python中velruse.api.register_provider函数的典型用法代码示例。如果您正苦于以下问题:Python register_provider函数的具体用法?Python register_provider怎么用?Python register_provider使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register_provider函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: add_yahoo_login
def add_yahoo_login(config,
realm=None,
storage=None,
consumer_key=None,
consumer_secret=None,
login_path='/login/yahoo',
callback_path='/login/yahoo/callback',
name='yahoo'):
"""
Add a Yahoo login provider to the application.
OpenID parameters: realm, storage
OAuth parameters: consumer_key, consumer_secret
"""
provider = YahooConsumer(name, realm, storage,
consumer_key, consumer_secret)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:RedTurtle,项目名称:velruse,代码行数:27,代码来源:yahoo.py
示例2: add_google_login
def add_google_login(config,
attrs=None,
realm=None,
storage=None,
consumer_key=None,
consumer_secret=None,
scope=None,
login_path='/login/google',
callback_path='/login/google/callback',
name='google'):
"""
Add a Google login provider to the application.
OpenID parameters: attrs, realm, storage
OAuth parameters: consumer_key, consumer_secret, scope
"""
provider = GoogleConsumer(name, attrs, realm, storage,
consumer_key, consumer_secret, scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider.login, route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:cguardia,项目名称:velruse,代码行数:29,代码来源:google.py
示例3: add_google_login
def add_google_login(config,
consumer_key=None,
consumer_secret=None,
scope=None,
login_path='/login/google',
callback_path='/login/google/callback',
name='google'):
"""
Add a Google login provider to the application supporting the new
OAuth2 protocol.
"""
provider = GoogleOAuth2Provider(
name,
consumer_key,
consumer_secret,
scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:osallou,项目名称:velruse,代码行数:26,代码来源:google_oauth2.py
示例4: add_openid_login
def add_openid_login(config,
attrs=None,
oattrs=None,
realm=None,
storage=None,
login_path='/login/openid',
callback_path='/login/openid/callback',
name='openid'):
"""
Add a OpenID login provider to the application.
`attrs` and `oattrs` are required and optional OpenID attributes
`storage` should be an object conforming to the
`openid.store.interface.OpenIDStore` protocol. This will default
to `openid.store.memstore.MemoryStore`.
"""
provider = OpenIDConsumer(name, attrs=attrs, oattrs=oattrs, realm=realm, storage=storage)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:rembish,项目名称:velruse,代码行数:27,代码来源:openid.py
示例5: add_github_login
def add_github_login(config,
consumer_key,
consumer_secret,
scope=None,
login_path='/login/github',
callback_path='/login/github/callback',
secure=True,
domain='github.com',
name='github'):
"""
Add a Github login provider to the application.
"""
provider = GithubProvider(name,
consumer_key,
consumer_secret,
scope,
secure,
domain)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:naktinis,项目名称:velruse,代码行数:28,代码来源:github.py
示例6: register_steam_provider
def register_steam_provider(config):
provider = SteamOpenIDConsumer(
'steam',
None,
'http://ohnozombi.es/',
None,
)
config.add_route(provider.login_route, '/login')
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, '/login/callback/',
use_global_views=True,
factory=provider.callback)
register_provider(config, 'steam', provider)
开发者ID:bobbyrward,项目名称:dota2_stats,代码行数:17,代码来源:steam_provider.py
示例7: add_google_login
def add_google_login(config,
attrs=None,
realm=None,
storage=None,
consumer_key=None,
consumer_secret=None,
scope=None,
login_path='/login/google',
callback_path='/login/google/callback',
name='google'):
"""
Add a Google login provider to the application using the OpenID+OAuth
hybrid protocol. This protocol can be configured for purely
authentication by specifying only OpenID parameters. If you also wish
to authorize your application to access the user's information you
may specify OAuth credentials.
- OpenID parameters
+ ``attrs``
+ ``realm``
+ ``storage``
- OAuth parameters
+ ``consumer_key``
+ ``consumer_secret``
+ ``scope``
"""
provider = GoogleConsumer(
name,
attrs,
realm,
storage,
consumer_key,
consumer_secret,
scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:RedTurtle,项目名称:velruse,代码行数:45,代码来源:google_hybrid.py
示例8: add_twitter_login
def add_twitter_login(
config,
consumer_key,
consumer_secret,
login_path="/login/twitter",
callback_path="/login/twitter/callback",
name="twitter",
):
"""
Add a Twitter login provider to the application.
"""
provider = TwitterProvider(name, consumer_key, consumer_secret)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr="login", route_name=provider.login_route, permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path, use_global_views=True, factory=provider.callback)
register_provider(config, name, provider)
开发者ID:naktinis,项目名称:velruse,代码行数:19,代码来源:twitter.py
示例9: add_linkedin_login
def add_linkedin_login(config,
consumer_key,
consumer_secret,
login_path='/linkedin/login',
callback_path='/linkedin/login/callback',
name='linkedin'):
"""
Add a Last.fm login provider to the application.
"""
provider = LinkedInProvider(name, consumer_key, consumer_secret)
config.add_route(provider.login_route, login_path)
config.add_view(provider.login, route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:mmariani,项目名称:velruse,代码行数:20,代码来源:linkedin.py
示例10: add_weibo_login
def add_weibo_login(config,
consumer_key,
consumer_secret,
login_path='/login/weibo',
callback_path='/login/weibo/callback',
name='weibo'):
"""
Add a Weibo login provider to the application.
"""
provider = WeiboProvider(name, consumer_key, consumer_secret)
config.add_route(provider.login_route, login_path)
config.add_view(provider.login, route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:jonnyquan,项目名称:velruse,代码行数:20,代码来源:weibo.py
示例11: add_bitbucket_login
def add_bitbucket_login(config,
consumer_key,
consumer_secret,
login_path='/bitbucket/login',
callback_path='/bitbucket/login/callback',
name='bitbucket'):
"""
Add a Bitbucket login provider to the application.
"""
provider = BitbucketProvider(name, consumer_key, consumer_secret)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:RedTurtle,项目名称:velruse,代码行数:20,代码来源:bitbucket.py
示例12: add_qq_login
def add_qq_login(config,
consumer_key,
consumer_secret,
scope=None,
login_path='/login/qq',
callback_path='/login/qq/callback',
name='qq'):
"""
Add a QQ login provider to the application.
"""
provider = QQProvider(name, consumer_key, consumer_secret, scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:RedTurtle,项目名称:velruse,代码行数:21,代码来源:qq.py
示例13: add_facebook_login
def add_facebook_login(config,
consumer_key,
consumer_secret,
scope=None,
login_path='/login/facebook',
callback_path='/login/facebook/callback',
name='facebook'):
"""
Add a Facebook login provider to the application.
"""
provider = FacebookProvider(name, consumer_key, consumer_secret, scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider.login, route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:jellonek,项目名称:velruse,代码行数:21,代码来源:facebook.py
示例14: add_yandex_login
def add_yandex_login(
config,
consumer_key,
consumer_secret,
login_path='/login/{name}'.format(name=PROVIDER_NAME),
callback_path='/login/{name}/callback'.format(name=PROVIDER_NAME),
name=PROVIDER_NAME
):
"""Add a Yandex login provider to the application."""
provider = YandexProvider(name, consumer_key, consumer_secret)
config.add_route(provider.login_route, login_path)
config.add_view(
provider,
attr='login',
route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED
)
config.add_route(
provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback
)
register_provider(config, name, provider)
开发者ID:shutaranga,项目名称:velruse,代码行数:23,代码来源:yandex.py
示例15: add_ubuntu_login
def add_ubuntu_login(config,
realm=None,
storage=None,
login_path='/login/openid',
callback_path='/login/openid/callback'):
"""
Add an Ubuntu SSO login provider to the application.
`storage` should be an object conforming to the
`openid.store.interface.OpenIDStore` protocol. This will default
to `openid.store.memstore.MemoryStore`.
"""
provider = UbuntuSSOConsumer(UBUNTU_SSO, realm, storage)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, UBUNTU_SSO, provider)
开发者ID:AdamIsrael,项目名称:review-queue,代码行数:23,代码来源:ubuntusso.py
示例16: add_google_login
def add_google_login(config,
attrs=None,
realm=None,
storage=None,
consumer_key=None,
consumer_secret=None,
scope=None,
login_path='/login/google',
callback_path='/login/google/callback',
name='google',
protocol='hybrid'):
"""
Add a Google login provider to the application.
Supports two protocols: OAuth2 and Hybrid (OAuth + OpenID).
OpenID parameters: attrs, realm, storage
OAuth parameters: consumer_key, consumer_secret, scope
"""
if protocol == 'oauth2':
provider = GoogleOAuth2Provider(name, consumer_key, consumer_secret, scope)
else:
provider = GoogleConsumer(name, attrs, realm, storage,
consumer_key, consumer_secret, scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:naktinis,项目名称:velruse,代码行数:36,代码来源:__init__.py
示例17: add_yasso_login
def add_yasso_login(config,
authorize_url,
token_url,
userinfo_url,
client_id,
client_secret,
login_path='/login/yasso',
callback_path='/login/yasso/callback',
name='yasso'):
"""
Add a Yasso login provider to the application.
"""
provider = YassoProvider(name, authorize_url, token_url, userinfo_url,
client_id, client_secret)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:araymund,项目名称:karl,代码行数:24,代码来源:sso_yasso.py
示例18: add_google_login
def add_google_login(config,
attrs=None,
realm=None,
storage=None,
consumer_key=None,
consumer_secret=None,
scope=None,
login_path='/login/google',
callback_path='/login/google/callback',
name='google',
protocol='hybrid'):
"""
Add a Google login provider to the application.
A Google provider can be configured to use different protocols to
authenticate with Google. If ``protocol`` is ``hybrid`` (the default)
then it will use OpenID+OAuth. Otherwise, if ``protocol`` is ``oauth2``
then authentication will happen via Google's OAuth2 endpoints.
The OpenID+OAuth (hybrid) protocol can be configured for purely
authentication by specifying only OpenID parameters. If you also wish
to authorize your application to access the user's information you
may specify OAuth credentials.
- OpenID parameters
+ ``attrs``
+ ``realm``
+ ``storage``
- OAuth parameters
+ ``consumer_key``
+ ``consumer_secret``
+ ``scope``
The OAuth2 endpoint only requires the ``consumer_key`` and
``consumer_secret`` with an optional ``scope``.
"""
if protocol == 'oauth2':
provider = GoogleOAuth2Provider(
name,
consumer_key,
consumer_secret,
scope)
else:
provider = GoogleConsumer(
name,
attrs,
realm,
storage,
consumer_key,
consumer_secret,
scope)
config.add_route(provider.login_route, login_path)
config.add_view(provider, attr='login', route_name=provider.login_route,
permission=NO_PERMISSION_REQUIRED)
config.add_route(provider.callback_route, callback_path,
use_global_views=True,
factory=provider.callback)
register_provider(config, name, provider)
开发者ID:glim,项目名称:velruse,代码行数:62,代码来源:__init__.py
注:本文中的velruse.api.register_provider函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论