1

我注册了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)
4

1 回答 1

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
}

然后将使用 and 填充 Flask-pyoidc 所需的clientId对象。我在 GitHub 存储库中有使用带有 App ID 的 Flask-pyoidc 的示例代码。它显示了从配置到使用装饰器保护 Flask 中的应用程序路由的所有步骤。secretclient_info

于 2018-05-05T09:45:26.517 回答