首页 文章

使用Google Appengine Python(Webapp2)我需要使用OpenID Connect对Microsoft的新V2 endpoints 进行身份验证

提问于
浏览
0

有内置的装饰器,可以轻松地让我访问谷歌自己的服务但是如何重载这些装饰器来调用其他 endpoints ,特别是微软V2 Azure endpoints (我需要对Office 365用户进行身份验证) .

我想覆盖的代码片段,用于调用其他 endpoints ,例如微软:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize

decorator = OAuth2Decorator(
  client_id='d4ea6ab9-adf4-4aec-9b99-675cf46ad37',
  redirect_uri='',
  client_secret='sW8rJYvWtCBVpge54L8684w',
  scope='')



class Authtest(BaseRequestHandler):

  @decorator.oauth_required

任何想法都非常感激 . 谢谢,伊恩

1 回答

  • 0

    浪费了很多时间,我可以确认您可以使用以下代码重载装饰器以指向Azure V2 endpoints :

    decorator = OAuth2Decorator(
      client_id='d4ea6ab9-adf4-4aec-9b99-675cf46XXX',
      auth_uri='https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
    
      response_type='id_token',
      response_mode='form_post',
      client_secret='sW8rJYvWtCBVpgXXXXX',
      extraQueryParameter='nux=1',
      state='12345',
      nonce='678910',
      scope=['openid','email','profile'])
    

    问题是装饰器纯粹是为了处理谷歌API而无法解码来自微软的响应,而有可能通过修改appengine.py中的代码来实现这一点,这是太多的工作 .

    因此,如果您希望通过Appengine对Microsoft Azure V2 endpoints 进行身份验证,则无法使用内置的OAuth2Decorator,这仅适用于Google自己的服务 .

相关问题