使用Azure DevOps Rest API查找PAT范围 [英] Find PAT scope using azure DevOps rest api

查看:97
本文介绍了使用Azure DevOps Rest API查找PAT范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究需要查找PAT是否具有完整范围的脚本.

I am working on script where I need to find if PAT has full scope or not.

我在Microsoft文档中找到了以下信息-

I found following information In Microsoft Docs -

获取使用此API,我可以找到所有PATS及其名称,范围和特定用户的更多详细信息.

Using this API I can find all the PATS and their names , scope and more details for particular user.

我不想在脚本中传递PAT名称,然后找出其范围.

I do not want to pass PAT name in script and then find out scope for it.

我想使用PAT令牌并为给定的PAT令牌返回范围

I want to use PAT token and return scope for the given PAT token

有没有可用的API来实现这一目标?

Is there any API available to achieve this ?

推荐答案

我不想在脚本中传递PAT名称,然后找出其范围.

I do not want to pass PAT name in script and then find out scope for it.

我想使用PAT令牌并返回给定PAT令牌的范围

I want to use PAT token and return scope for the given PAT token

目前恐怕还没有办法通过PAT令牌而不是PAT名称返回PAT范围.

I am afraid there is no such way to return PAT scope via PAT token instead of PAT name at this moment.

就像返回REST API一样

Just as return of the REST API Personal Access Tokens - List:

    {
        "clientId": "00000000-0000-0000-0000-000000000000",
        "accessId": "439729fa-be4e-49b2-8530-263cf053d786",
        "authorizationId": "a451306e-621d-4a6c-8c54-9096493a40f9",
        "hostAuthorizationId": "00000000-0000-0000-0000-000000000000",
        "userId": "c1b9603c-da3a-410e-9e59-074dcee61dcc",
        "validFrom": "2021-01-07T00:00:00",
        "validTo": "2021-02-06T00:00:00",
        "displayName": "TestPATA1",
        "scope": "app_token",
        "targetAccounts": [
            "c519b80d-5d71-46b3-a8e0-3edf8c026ea2"
        ],
        "token": null,
        "alternateToken": null,
        "isValid": true,
        "isPublic": false,
        "publicData": null,
        "source": null,
        "claims": null
    },

响应主体不包含PAT令牌的值,因此,我们可以将PAT令牌的值与每个PAT关联.

The response body does not contain the value of the PAT token, therefore, we could associate the value of the PAT token with each PAT.

另一方面,当我们创建PAT时,我们将收到消息:

On the other hand, when we create the PAT, we will receive the message:

警告-确保立即复制以上令牌.我们不存储它,您将无法再次看到它.

出于安全原因,Azure开发人员不会保存我们创建的PAT值.因此,将没有任何属性,例如在Azure devops中保存或记录PAT值,因此我们不能将PAT令牌用作判断条件.

For security reasons, Azure devops does not save the PAT value we created. Therefore, there will not be any attributes such as saving or recording the PAT value in Azure devops, so we could not use PAT token as a judgment condition.

这篇关于使用Azure DevOps Rest API查找PAT范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆