【问题标题】:How to use Python OpenID Connect module with IBM Cloud App ID?如何将 Python OpenID Connect 模块与 IBM Cloud App ID 结合使用?
【发布时间】:2018-09-24 05:12:51
【问题描述】:

我注册了IBM Cloud App ID 以保护对我的云应用程序的访问。有一个示例显示该服务可以与 Python 一起使用。但是,我想使用其中一个(标准)OpenID Connect 模块。如何配置,例如 Flask-pyoidc 以使用 App ID?它需要几个参数,我不确定它们与 App ID 提供的内容有何关系。

provider_config = {
    'issuer': 'https://op.example.com',
    'authorization_endpoint': 'https://op.example.com/authorize',
    'token_endpoint': 'https://op.example.com/token',
    'userinfo_endpoint': 'https://op.example.com/userinfo'
}
auth = OIDCAuthentication(provider_configuration_info=provider_config)

【问题讨论】:

    标签: python authentication ibm-cloud openid-connect ibm-appid


    【解决方案1】:

    这是provider_config 的配置方法。

    provider_config={
         "issuer": "appid-oauth.ng.bluemix.net",
         "authorization_endpoint": appIDInfo['oauthServerUrl']+"/authorization",
         "token_endpoint": appIDInfo['oauthServerUrl']+"/token",
         "userinfo_endpoint": appIDInfo['profilesUrl']+"/api/v1/attributes",
         "jwks_uri": appIDInfo['oauthServerUrl']+"/publickeys"
    }
    

    appIDInfo 可以从 IBM Cloud 上的 Cloud Foundry 环境中获取,也可以使用如下结构手动配置:

    "AppID": {
         "clientId": "your App ID client Id",
         "managementUrl": "https://appid-management.ng.bluemix.net/management/v4/-----tenantID----",
         "oauthServerUrl": "https://appid-oauth.ng.bluemix.net/oauth/v3/-----tenantID----",
         "profilesUrl": "https://appid-profiles.ng.bluemix.net",
         "secret": "the App ID secret",
         "tenantId": "-----tenantID----",
         "version": 3
    }
    

    clientIdsecret 然后将用于填充 Flask-pyoidc 所需的 client_info 对象。我有sample code using Flask-pyoidc with App ID in a GitHub repository。它展示了从配置到使用装饰器保护 Flask 中的应用程序路由的所有步骤。

    【讨论】:

    • 不错。有什么计划来捕捉这将如何与龙卷风一起工作?
    • 我还没用过Tornado,不过可以看看其他教程。
    • 不用担心。有机会我会亲自去看看。我真的很喜欢龙卷风,与烧瓶不同的是,它非常固执己见,如果你不一直使用它会很有帮助。有一本很棒的书here 我创建了一个云铸造龙卷风你好世界here
    猜你喜欢
    • 1970-01-01
    • 2020-02-16
    • 2015-05-29
    • 1970-01-01
    • 2020-10-22
    • 2019-04-02
    • 1970-01-01
    • 2014-03-29
    • 2019-12-21
    相关资源
    最近更新 更多