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

feat: add support for access token storage and REST handlers #1342

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

Conversation

mrchocha
Copy link

@mrchocha mrchocha commented Sep 21, 2023

Context

This PR contains feature to support access token management (create/list/validation) via rest apis and memphis gateway. here is list of functionality which will be added

  • Creation and listing of access tokens from db via REST end points ( see examples )
  • Token creations and validation via SDK handlers (i.e. memphis gateway )

Issue & Relevant PRs

Examples

Access Token Creation via REST end point

Input

curl --location 'http://localhost:9000/api/accessToken/createNewAccessToken' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbHJlYWR5X2xvZ2dlZF9pbiI6dHJ1ZSwiYXZhdGFyX2lkIjoxLCJjcmVhdGlvbl9kYXRlIjoiMjAyMy0wOS0xOVQxNTozNjo1Mi42NzI1MTErMDU6MzAiLCJleHAiOjE2OTUyOTczNjcsInRlbmFudF9uYW1lIjoiJG1lbXBoaXMiLCJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJyb290IiwidXNlcm5hbWUiOiJyb290In0.KfxOM2in7GBLaFfE6krqGHGl79mje98mwzG34ix7EhA' \
--header 'Content-Type: application/json' \
--header 'Cookie: memphis-jwt-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbHJlYWR5X2xvZ2dlZF9pbiI6dHJ1ZSwiYXZhdGFyX2lkIjoxLCJjcmVhdGlvbl9kYXRlIjoiMjAyMy0wOS0xOVQxNTozNjo1Mi42NzI1MTErMDU6MzAiLCJleHAiOjE2OTU0NjkyNjcsInRlbmFudF9uYW1lIjoiJG1lbXBoaXMiLCJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJyb290IiwidXNlcm5hbWUiOiJyb290In0.dhJXniH4V7Xh3t7w7e6Ow161GfR7e0hR-M6SYj9ELS4' \
--data '{
    "description": "New access token for my API!"
}'

Output

{
    "access_key_id": "8vw8ZhhaHxVzpdl",
    "secret_key": "SvRgRxlWp0lzyRrrc58lBQ1u75RjgA"
}

Access Token Listing via REST end point

Input

curl --location 'http://localhost:9000/api/accessToken/getAllAccessTokens' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbHJlYWR5X2xvZ2dlZF9pbiI6dHJ1ZSwiYXZhdGFyX2lkIjoxLCJjcmVhdGlvbl9kYXRlIjoiMjAyMy0wOS0xOVQxNTozNjo1Mi42NzI1MTErMDU6MzAiLCJleHAiOjE2OTUyOTczNjcsInRlbmFudF9uYW1lIjoiJG1lbXBoaXMiLCJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJyb290IiwidXNlcm5hbWUiOiJyb290In0.KfxOM2in7GBLaFfE6krqGHGl79mje98mwzG34ix7EhA' \
--header 'Cookie: memphis-jwt-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbHJlYWR5X2xvZ2dlZF9pbiI6dHJ1ZSwiYXZhdGFyX2lkIjoxLCJjcmVhdGlvbl9kYXRlIjoiMjAyMy0wOS0xOVQxNTozNjo1Mi42NzI1MTErMDU6MzAiLCJleHAiOjE2OTU0NjkyNjcsInRlbmFudF9uYW1lIjoiJG1lbXBoaXMiLCJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJyb290IiwidXNlcm5hbWUiOiJyb290In0.dhJXniH4V7Xh3t7w7e6Ow161GfR7e0hR-M6SYj9ELS4'

Output

[
    {
        "id": 1,
        "tenant_name": "$memphis",
        "is_active": true,
        "generated_by": 1,
        "access_key_id": "8vw8ZhhaHxVzpdl",
        "created_at": "2023-09-21T17:11:21.913348+05:30",
        "description": "New access token for my API!"
    }
]

@mrchocha
Copy link
Author

hey @idanasulinmemphis, did you get a chance to look into this PR? let me know if any suggestions.

@idanasulin2706
Copy link
Contributor

Hi @mrchocha sorry for the late response, we will review it during the next couple of weeks since we are still preparing the QA process that should check the job that you did

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

Successfully merging this pull request may close these issues.

2 participants