【问题标题】:Azure DevOps OAuth organization policies APIAzure DevOps OAuth 组织策略 API
【发布时间】:2020-09-18 08:41:29
【问题描述】:

有没有办法通过 API 了解第三方 OAuth 请求的组织政策是什么?

我想知道我是否应该要求我的用户使用他的凭据进行身份验证或生成 PAT

【问题讨论】:

    标签: azure-devops azure-devops-rest-api azure-devops-extensions


    【解决方案1】:

    有没有办法通过 API 了解 3rd 的组织政策是什么 参与方 OAuth 请求?

    您可以使用我从 F12 获取的这个 api:

    Get https://dev.azure.com/{YourOrgName}/_settings/organizationPolicy?__rt=fps&__ver=2
    

    响应将包含有关 Application Connection Policies 的信息:

                   "ms.vss-admin-web.organization-policies-data-provider": {
                        "policies": {
                            "applicationConnection": [
                                {
                                    "policy": {
                                        "name": "Policy.DisallowOAuthAuthentication",
                                        "value": false,
                                        "effectiveValue": true,
                                        "parentPolicy": {
                                            "name": "Policy.DisallowOAuthAuthentication",
                                            "value": false,
                                            "effectiveValue": true,
                                            "isValueUndefined": true
                                        }
                                    },
                                    "learnMoreLink": "https://aka.ms/vstspolicyoauth",
                                    "description": "Third-party application access via OAuth",
                                    "applicableServiceHost": 1
                                },
                                {
                                    "policy": {
                                        "name": "Policy.DisallowSecureShell",
                                        "value": false,
                                        "effectiveValue": true,
                                        "isValueUndefined": true,
                                        "parentPolicy": {
                                            "name": "Policy.DisallowSecureShell",
                                            "value": false,
                                            "effectiveValue": true,
                                            "isValueUndefined": true
                                        }
                                    },
                                    "learnMoreLink": "https://aka.ms/vstspolicyssh",
                                    "description": "SSH authentication",
                                    "applicableServiceHost": 1
                                }
                            ]...
    

    对应的policy 节点下的effectiveValue(不是value 节点)节点应该代表您是否在图片中启用/禁用上述策略。例如:如果Third-party application access via OAuth 被禁用,则第一个policy 节点下的effectiveValue 节点将为false

    【讨论】:

    • 我仍然需要用户进行身份验证才能获取此数据。我想先查询一下,这样我就可以提供不同类型的身份验证 - OAuth vs PAT
    • @bk 抱歉,恐怕没有其他的 api 或 azure devops 扩展 api 可用于获取组织策略信息。到目前为止,只有这个没有证件的人可以访问您想要的信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-08-19
    • 2019-05-11
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-29
    相关资源
    最近更新 更多