Skip to content

Admin Token API: Revoke Incoming Email Tokens

What does this MR do and why?

This MR adds support for revocation of incoming email tokens to the Admin token API.

Issue: #517677 (closed)

🛠️ with ❤️ at Siemens

References

MR acceptance checklist

checklist

How to set up and validate locally

  1. Enable the feature flag with rails c:
Feature.enable(:api_admin_token_revoke)
  1. You'll need to create a personal access token to access the token and get an incoming mail token token that you'd like to revoke:
    1. Create a personal access token with admin_mode and api capabilities. Preferences > Access Tokens > Add a new token
    2. You'll need an incoming email token of a user. If you've seeded the GDK, you can get a token from an existing user in the rails console:
User.last.incoming_email_token
  1. Now you can retrieve information about this token:
curl -k --request POST \
--url 'https://gdk.test:3443/api/v4/admin/token' \
--header 'Authorization: Bearer <Admin Token from Step 2.>' \
--header 'Content-Type: application/json' \
--data '{"token": "glimt-token-from-step-2-2"}'
  1. Now, revoke the token:
curl -k --request DELETE \
--url 'https://gdk.test:3443/api/v4/admin/token \       
--header 'Authorization: Bearer <Admin Token from Step 1.>' \
--header 'Content-Type: application/json' \
--data '{"token": "glimt-token-from-step-2-2"}'
  1. Query the token again - you should now see that the status changed to Not Found, as the incoming email token has changed. You can also use rails cto query the user again and check the token.

Related to #517677 (closed)

Edited by Nicholas Wittstruck

Merge request reports

Loading