Skip to content

Token API

Okke Harsta edited this page Oct 5, 2022 · 2 revisions

Token-API

Fetch tokens

If you run the TokenControllerTest the test seed resides in the mongo test database. Fetch all tokens that have at least one audience which at least has one scope.

curl -u eduid:secret "http://localhost:8080/v2/tokens?unspecifiedID=urn%3Acollab%3Aperson%3Aeduid.nl%3A7d4fca9b-2169-4d55-8347-73cf29b955a2" | jq .

The result:

[
  {
    "expiresIn": "2022-07-07T07:25:48.843+00:00",
    "createdAt": "2022-10-05T07:25:48.843+00:00",
    "clientId": "playground_client",
    "clientName": "Playground Client",
    "audiences": [
      {
        "description:nl": "",
        "OrganizationName:nl:": "",
        "description:en": "",
        "scopes": [
          {
            "name": "groups",
            "titles": {},
            "descriptions": {
              "en": "English description",
              "nl": "nl",
              "pt": "pt"
            }
          }
        ],
        "OrganizationName:en:": "",
        "name:nl": "ResourceServer",
        "name:en": "ResourceServer"
      },
      {
        "description:nl": "",
        "OrganizationName:nl:": "",
        "description:en": "",
        "scopes": [
          {
            "name": "groups",
            "titles": {
              "en": "English title",
              "nl": "NL titel",
              "pt": "pt"
            },
            "descriptions": {
              "en": "English description",
              "nl": "nl",
              "pt": "pt"
            }
          }
        ],
        "OrganizationName:en:": "",
        "name:nl": "OpenConext Mock SP",
        "name:en": "OpenConext Mock SP"
      }
    ],
    "id": "633d317cb2dfc821a4348582",
    "type": "ACCESS"
  },
  {
    "expiresIn": "2022-07-07T07:25:48.922+00:00",
    "createdAt": "2022-10-05T07:25:48.922+00:00",
    "clientId": "playground_client",
    "clientName": "Playground Client",
    "audiences": [
      {
        "description:nl": "",
        "OrganizationName:nl:": "",
        "description:en": "",
        "scopes": [
          {
            "name": "groups",
            "titles": {},
            "descriptions": {
              "en": "English description",
              "nl": "nl",
              "pt": "pt"
            }
          }
        ],
        "OrganizationName:en:": "",
        "name:nl": "ResourceServer",
        "name:en": "ResourceServer"
      },
      {
        "description:nl": "",
        "OrganizationName:nl:": "",
        "description:en": "",
        "scopes": [
          {
            "name": "groups",
            "titles": {
              "en": "English title",
              "nl": "NL titel",
              "pt": "pt"
            },
            "descriptions": {
              "en": "English description",
              "nl": "nl",
              "pt": "pt"
            }
          }
        ],
        "OrganizationName:en:": "",
        "name:nl": "OpenConext Mock SP",
        "name:en": "OpenConext Mock SP"
      }
    ],
    "id": "633d317cb2dfc821a4348585",
    "type": "REFRESH"
  }
]

Delete tokens

To delete tokens you have to specify the id and type and PUT this data

curl -u eduid:secret -X PUT -H "Content-type: application/json" -d '[ {"id" : "633d332803027624bdb55098", "type" : "REFRESH"}, {"id" : "633d332703027624bdb55095","type" : "ACCESS"} ]' "http://localhost:8080/v2/tokens"

Which will return HTTP/1.1 204

Clone this wiki locally