Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Added sample for token administration #152

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

kigunda
Copy link

@kigunda kigunda commented Jul 19, 2018

The TokenAdmin sample shows organization administrators how they can use the VSTS REST APIs to find and revoke personal access tokens (PATs) for users in their organization. It also shows how to create revocation rules that prevent access through other OAuth credentials, such as self-describing session tokens. The sample is written using our C# client libraries, but is commented with the HTTP calls that administrators can make to perform these same operations directly over the wire.

The methods in this sample, and the endpoints they cover are:

  • GetPersonalAccessTokenDetailsForUsersInYourOrganization
    GET /_apis/tokenAdmin/personalAccessTokens/{subjectDescriptor}

  • RevokePersonalAccessTokensForUsersInYourOrganization
    POST /_apis/tokenAdmin/revocations

  • RevokeSelfDescribingSessionTokensForUsersInYourOrganization
    POST /_apis/tokenAdmin/revocationRules

@kigunda kigunda requested a review from marcusm July 19, 2018 03:51
@msftclas
Copy link

msftclas commented Jul 19, 2018

CLA assistant check
All CLA requirements met.

Copy link
Collaborator

@willsmythe willsmythe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Kenan :) - I think a few of your new sample methods go beyond just being a "snippet" (i.e. mainly designed for showing 1 API call, and generally designed not to actually do anything "real" --- e.g. the delete sample deletes an artifact created in a previous sample method).

You should consider having 1 sample method per API (e.g. 1 method to get all authorizations, 1 method to delete a specific authorization, etc) and then create a standalone sample project (like https://github.com/Microsoft/vsts-dotnet-samples/tree/master/ServiceHooks/Utilities/Permissions). A standalone project is likely easier to consume and can be as complex or simple as makes sense for what you need to show.

@vtbassmatt
Copy link
Member

If this is still relevant, can you retarget it to main?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants