Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccessServiceManager create access token #753

Open
kaedwen opened this issue Apr 26, 2023 · 0 comments
Open

AccessServiceManager create access token #753

kaedwen opened this issue Apr 26, 2023 · 0 comments
Labels
question Further information is requested

Comments

@kaedwen
Copy link

kaedwen commented Apr 26, 2023

Hi,

I want to create access tokens with the help of the AccessServiceManager.CreateAccessToken() function.

In principle I am doing this

refreshable := true
params := aservices.CreateTokenParams{
  CommonTokenParams: sauth.CommonTokenParams{
	Refreshable: &refreshable,
	ExpiresIn:   int(time.Duration(1 * time.Hour).Seconds()),
	Scope:       "applied-permissions/user",
  },
}

token, err := m.CreateAccessToken(params)
if err != nil {
  log.Fatalln(err)
}

And it is creating a token which is also showing up in the UI.

But for some reason it is not revocable. Using the UI prints that error.
Using curl I get

{
  "code" : "BAD_REQUEST",
  "message" : "Token not revocable",
  "detail" : "Token not revocable. Token expirationTimeMillis: 1682507561843, issuedAtMillis: 1682503961843, revocableExpiryThresholdMillis: 21600000"
}

But if I only use curl the creation and the revoke does work

curl -XPOST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' "$BASE/access/api/v1/tokens" -d @payload.json
curl -XDELETE -H "Authorization: Bearer $TOKEN" "$BASE/access/api/v1/tokens/4078c9f9-35e2-48c4-b1eb-532fc5a7cecc"

And the token is gone, also in the UI.

What I have seen is that when I go with curl I deliver a description field which is visible in Artifactory in the Identity Token table. Maybe it is just because there is no entry set here?

@kaedwen kaedwen added the question Further information is requested label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant