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

IAM 782 #267

Merged
merged 5 commits into from
Apr 9, 2024
Merged

IAM 782 #267

merged 5 commits into from
Apr 9, 2024

Conversation

shipperizer
Copy link
Contributor

@shipperizer shipperizer commented Apr 5, 2024

IAM-782 + IAM-784: pagination for Kratos

  • fix: add page tokens to the response
  • feat: parse and expose link header from hydra
  • feat: adjust identity api to accept page token
  • feat: adjust pagination for schemas endpoints
shipperizer in ~/shipperizer/identity-platform-admin-ui on IAM-782 ● ● λ http :8000/api/v0/identities size==3                                                 
HTTP/1.1 200 OK
Content-Type: application/json
Date: Fri, 05 Apr 2024 16:53:26 GMT
Transfer-Encoding: chunked

{
    "_meta": {
        "first": "00000000-0000-0000-0000-000000000000",
        "page": 0,
        "page_token": "",
        "size": 3
    },
    "data": [
        {
            "created_at": "2024-04-05T16:28:24.406322Z",
            "id": "60a09add-4957-4ef6-9549-68ad38c5606a",
            "organization_id": null,
            "recovery_addresses": [
                {
                    "created_at": "2024-04-05T16:28:24.407827Z",
                    "id": "d79292dd-48b8-47c8-844e-39e5d7f594c7",
                    "updated_at": "2024-04-05T16:28:24.407827Z",
                    "value": "[email protected]",
                    "via": "email"
                }
            ],
            "schema_id": "default",
            "schema_url": "http://kratos-7cbb94c499-jhklw:4433/schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2024-04-05T16:28:24.401155Z",
            "traits": {
                "email": "[email protected]"
            },
            "updated_at": "2024-04-05T16:28:24.406322Z",
            "verifiable_addresses": [
                {
                    "created_at": "2024-04-05T16:28:24.407279Z",
                    "id": "289c8bed-ae80-4d6c-84bd-9a584ea1784e",
                    "status": "pending",
                    "updated_at": "2024-04-05T16:28:24.407279Z",
                    "value": "[email protected]",
                    "verified": false,
                    "via": "email"
                }
            ]
        },
        {
            "created_at": "2024-04-05T16:32:11.415531Z",
            "id": "a37a64ec-4cac-48d9-8639-937cbc2981bc",
            "organization_id": null,
            "recovery_addresses": [
                {
                    "created_at": "2024-04-05T16:32:11.417057Z",
                    "id": "c12fc956-30a4-46a3-b2dd-b8ed4a5e2b3f",
                    "updated_at": "2024-04-05T16:32:11.417057Z",
                    "value": "[email protected]",
                    "via": "email"
                }
            ],
            "schema_id": "default",
            "schema_url": "http://kratos-7cbb94c499-jhklw:4433/schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2024-04-05T16:32:11.414872Z",
            "traits": {
                "email": "[email protected]"
            },
            "updated_at": "2024-04-05T16:32:11.415531Z",
            "verifiable_addresses": [
                {
                    "created_at": "2024-04-05T16:32:11.416602Z",
                    "id": "f66b2a90-7de7-4fa1-8151-d720d0e9bb55",
                    "status": "pending",
                    "updated_at": "2024-04-05T16:32:11.416602Z",
                    "value": "[email protected]",
                    "verified": false,
                    "via": "email"
                }
            ]
        },
        {
            "created_at": "2024-04-05T16:31:49.896801Z",
            "id": "a574aed1-4dbe-4dbe-8290-0c9a161f6d4d",
            "organization_id": null,
            "recovery_addresses": [
                {
                    "created_at": "2024-04-05T16:31:49.898386Z",
                    "id": "258a3d92-6e01-4d7b-a611-ad8a5a4ed75a",
                    "updated_at": "2024-04-05T16:31:49.898386Z",
                    "value": "[email protected]",
                    "via": "email"
                }
            ],
            "schema_id": "default",
            "schema_url": "http://kratos-7cbb94c499-jhklw:4433/schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2024-04-05T16:31:49.896059Z",
            "traits": {
                "email": "[email protected]"
            },
            "updated_at": "2024-04-05T16:31:49.896801Z",
            "verifiable_addresses": [
                {
                    "created_at": "2024-04-05T16:31:49.89793Z",
                    "id": "237df955-f256-4ee1-991e-d19bf2320dfe",
                    "status": "pending",
                    "updated_at": "2024-04-05T16:31:49.89793Z",
                    "value": "[email protected]",
                    "verified": false,
                    "via": "email"
                }
            ]
        }
    ],
    "message": "List of identities",
    "status": 200
}


shipperizer in ~/shipperizer/identity-platform-admin-ui on IAM-782 ● ● λ http :8000/api/v0/identities size==2 
HTTP/1.1 200 OK
Content-Length: 1742
Content-Type: application/json
Date: Fri, 05 Apr 2024 16:53:34 GMT

{
    "_meta": {
        "first": "00000000-0000-0000-0000-000000000000",
        "next": "a37a64ec-4cac-48d9-8639-937cbc2981bc",
        "page": 0,
        "page_token": "",
        "size": 2
    },
    "data": [
        {
            "created_at": "2024-04-05T16:28:24.406322Z",
            "id": "60a09add-4957-4ef6-9549-68ad38c5606a",
            "organization_id": null,
            "recovery_addresses": [
                {
                    "created_at": "2024-04-05T16:28:24.407827Z",
                    "id": "d79292dd-48b8-47c8-844e-39e5d7f594c7",
                    "updated_at": "2024-04-05T16:28:24.407827Z",
                    "value": "[email protected]",
                    "via": "email"
                }
            ],
            "schema_id": "default",
            "schema_url": "http://kratos-7cbb94c499-jhklw:4433/schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2024-04-05T16:28:24.401155Z",
            "traits": {
                "email": "[email protected]"
            },
            "updated_at": "2024-04-05T16:28:24.406322Z",
            "verifiable_addresses": [
                {
                    "created_at": "2024-04-05T16:28:24.407279Z",
                    "id": "289c8bed-ae80-4d6c-84bd-9a584ea1784e",
                    "status": "pending",
                    "updated_at": "2024-04-05T16:28:24.407279Z",
                    "value": "[email protected]",
                    "verified": false,
                    "via": "email"
                }
            ]
        },
        {
            "created_at": "2024-04-05T16:32:11.415531Z",
            "id": "a37a64ec-4cac-48d9-8639-937cbc2981bc",
            "organization_id": null,
            "recovery_addresses": [
                {
                    "created_at": "2024-04-05T16:32:11.417057Z",
                    "id": "c12fc956-30a4-46a3-b2dd-b8ed4a5e2b3f",
                    "updated_at": "2024-04-05T16:32:11.417057Z",
                    "value": "[email protected]",
                    "via": "email"
                }
            ],
            "schema_id": "default",
            "schema_url": "http://kratos-7cbb94c499-jhklw:4433/schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2024-04-05T16:32:11.414872Z",
            "traits": {
                "email": "[email protected]"
            },
            "updated_at": "2024-04-05T16:32:11.415531Z",
            "verifiable_addresses": [
                {
                    "created_at": "2024-04-05T16:32:11.416602Z",
                    "id": "f66b2a90-7de7-4fa1-8151-d720d0e9bb55",
                    "status": "pending",
                    "updated_at": "2024-04-05T16:32:11.416602Z",
                    "value": "[email protected]",
                    "verified": false,
                    "via": "email"
                }
            ]
        }
    ],
    "message": "List of identities",
    "status": 200
}


shipperizer in ~/shipperizer/identity-platform-admin-ui on IAM-782 ● ● λ  
shipperizer in ~/shipperizer/identity-platform-admin-ui on IAM-782 ● ● λ http :8000/api/v0/identities size==2  page_token==a37a64ec-4cac-48d9-8639-937cbc2981bc
HTTP/1.1 200 OK
Content-Length: 949
Content-Type: application/json
Date: Fri, 05 Apr 2024 16:53:45 GMT

{
    "_meta": {
        "first": "00000000-0000-0000-0000-000000000000",
        "page": 0,
        "page_token": "a37a64ec-4cac-48d9-8639-937cbc2981bc",
        "size": 2
    },
    "data": [
        {
            "created_at": "2024-04-05T16:31:49.896801Z",
            "id": "a574aed1-4dbe-4dbe-8290-0c9a161f6d4d",
            "organization_id": null,
            "recovery_addresses": [
                {
                    "created_at": "2024-04-05T16:31:49.898386Z",
                    "id": "258a3d92-6e01-4d7b-a611-ad8a5a4ed75a",
                    "updated_at": "2024-04-05T16:31:49.898386Z",
                    "value": "[email protected]",
                    "via": "email"
                }
            ],
            "schema_id": "default",
            "schema_url": "http://kratos-7cbb94c499-jhklw:4433/schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2024-04-05T16:31:49.896059Z",
            "traits": {
                "email": "[email protected]"
            },
            "updated_at": "2024-04-05T16:31:49.896801Z",
            "verifiable_addresses": [
                {
                    "created_at": "2024-04-05T16:31:49.89793Z",
                    "id": "237df955-f256-4ee1-991e-d19bf2320dfe",
                    "status": "pending",
                    "updated_at": "2024-04-05T16:31:49.89793Z",
                    "value": "[email protected]",
                    "verified": false,
                    "via": "email"
                }
            ]
        }
    ],
    "message": "List of identities",
    "status": 200
}

to notice

  • identities API has UUID tokens that match the next resource
  • schemas API uses base64 encoded tokens with an offset key
  • rules API will follow the base64 offset pattern as current implementation in Oathkeeper is relying on page and size, no page token Standardize rules API pagination strategy  #268

this is by Ory design

TODO

  • rebase

@shipperizer shipperizer self-assigned this Apr 5, 2024
@shipperizer shipperizer marked this pull request as ready for review April 5, 2024 20:58
@shipperizer shipperizer requested a review from a team as a code owner April 5, 2024 20:58
@shipperizer shipperizer added bug Something isn't working help wanted Extra attention is needed labels Apr 5, 2024
@shipperizer shipperizer force-pushed the IAM-782 branch 2 times, most recently from 3951e41 to c78a36b Compare April 8, 2024 09:17
BarcoMasile
BarcoMasile previously approved these changes Apr 8, 2024
@shipperizer shipperizer merged commit 11415ec into main Apr 9, 2024
6 checks passed
@shipperizer shipperizer deleted the IAM-782 branch April 9, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants