Skip to content

feat: add support for access token generation and authentication#53

Open
mrchocha wants to merge 1 commit into
superstreamlabs:masterfrom
mrchocha:feat/add-support-for-access-token-creation-and-authentication
Open

feat: add support for access token generation and authentication#53
mrchocha wants to merge 1 commit into
superstreamlabs:masterfrom
mrchocha:feat/add-support-for-access-token-creation-and-authentication

Conversation

@mrchocha

@mrchocha mrchocha commented Sep 21, 2023

Copy link
Copy Markdown

Context

  • This PR contains feature to create access tokens and authenticate request via access token (which are stored in broker)

Issue & Relevant PRs

Examples

Generate New Access Token

curl --location 'http://localhost:4444/auth/generateAccessToken' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoxLCJjb25uZWN0aW9uX3Rva2VuIjoiIiwiZXhwIjoyMDU1MzAxMTkwLCJwYXNzd29yZCI6Im1lbXBoaXMiLCJ1c2VybmFtZSI6InJvb3QifQ.HCJvG-UQG2kDNNlNlOovbLIf8E6VHPYAaV3JYnDo8Gc' \
--header 'Content-Type: application/json' \
--header 'Cookie: memphis-jwt-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbHJlYWR5X2xvZ2dlZF9pbiI6dHJ1ZSwiYXZhdGFyX2lkIjoxLCJjcmVhdGlvbl9kYXRlIjoiMjAyMy0wOS0xOVQxNTozNjo1Mi42NzI1MTErMDU6MzAiLCJleHAiOjE2OTU0NjkyNjcsInRlbmFudF9uYW1lIjoiJG1lbXBoaXMiLCJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJyb290IiwidXNlcm5hbWUiOiJyb290In0.dhJXniH4V7Xh3t7w7e6Ow161GfR7e0hR-M6SYj9ELS4' \
--data '{
    "description": "New Access Tokens from gateway"
}
'

Output

{
    "access_key_id": "rAgfLcvAftjqTOu",
    "secret_key": "BsNjQDqBlxaRbjYyaBviLfYPu3iH1d"
}

Use Access Token in other requests instead of JWT

curl --location 'http://localhost:4444/stations/s1/produce/single' \
--header 'Access-Key-Id: rAgfLcvAftjqTOu' \
--header 'Secret-Key: BsNjQDqBlxaRbjYyaBviLfYPu3iH1d' \
--header 'Content-Type: application/json' \
--header 'Cookie: memphis-jwt-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbHJlYWR5X2xvZ2dlZF9pbiI6dHJ1ZSwiYXZhdGFyX2lkIjoxLCJjcmVhdGlvbl9kYXRlIjoiMjAyMy0wOS0xOVQxNTozNjo1Mi42NzI1MTErMDU6MzAiLCJleHAiOjE2OTU0NjkyNjcsInRlbmFudF9uYW1lIjoiJG1lbXBoaXMiLCJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJyb290IiwidXNlcm5hbWUiOiJyb290In0.dhJXniH4V7Xh3t7w7e6Ow161GfR7e0hR-M6SYj9ELS4' \
--data '{
    "message":"With Access Token yooohoo, its working!!!"
}'

Output

{
    "error": null,
    "success": true
}

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.

1 participant