-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to pass value to jwt claim called app (#16)
- Loading branch information
1 parent
be6a8c3
commit c344b1a
Showing
13 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,9 +79,12 @@ Response: | |
"attributes": { | ||
"name": "Authy Person", | ||
"email": "[email protected]", | ||
"metadata": { | ||
"tenant": "tenantID" | ||
}, | ||
"metadata": { | ||
"company": "Auth Co" | ||
}, | ||
"app": { | ||
"tenantID": "1234" | ||
}, | ||
"active": 1, | ||
"created": "2023-02-02T21:33:53.926Z", | ||
"updated": "2023-02-02T21:33:53.926Z" | ||
|
@@ -93,9 +96,12 @@ Response: | |
"attributes": { | ||
"name": "Authy Person 2", | ||
"email": "[email protected]", | ||
"metadata": { | ||
"tenant": "tenantID" | ||
}, | ||
"metadata": { | ||
"company": "Auth Co" | ||
}, | ||
"app": { | ||
"tenantID": "5678" | ||
}, | ||
"active": 1, | ||
"created": "2023-02-02T21:34:37.712Z", | ||
"updated": "2023-02-02T21:34:37.712Z" | ||
|
@@ -118,7 +124,7 @@ Description: Creates a new user in the Authcompanion database. | |
|
||
Bearer Token Required: `Authorization: Bearer {admin access token}` | ||
|
||
Pass an arbitrary object to data.attributes.metdata which will be made available as a claim on the user's JWT issued after login. | ||
Optional: Pass an arbitrary object to data.attributes.metadata which will be made available as a claim on the user's JWT issued after login, this claim is changable using the user token. Pass an arbitrary object to data.attributes.app which will be made available as a claim on the user's JWT issued after login, this claim is changable only using the admin token (aka a "private" claim). | ||
|
||
**POST** Request Body: | ||
|
||
|
@@ -131,9 +137,12 @@ Pass an arbitrary object to data.attributes.metdata which will be made available | |
"email": "[email protected]", | ||
"password": "supersecret", | ||
"metadata": { | ||
"tenant": "tenantID" | ||
"company": "Auth Co" | ||
}, | ||
"active": 1, | ||
"app": { | ||
"tenantID": "1234" | ||
}, | ||
"active": 1 | ||
} | ||
} | ||
} | ||
|
@@ -150,7 +159,10 @@ Response: | |
"name": "Authy Person", | ||
"email": "[email protected]", | ||
"metadata": { | ||
"tenant": "tenantID" | ||
"company": "Auth Co" | ||
}, | ||
"app": { | ||
"tenantID": "1234" | ||
}, | ||
"active": 1, | ||
"created": "2023-02-02T21:33:53.926Z", | ||
|
@@ -168,7 +180,7 @@ Description: Updates a single user from the Authcompanion database with the user | |
|
||
Bearer Token Required: `Authorization: Bearer {admin access token}` | ||
|
||
Pass an arbitrary object to data.attributes.metdata which will be made available as a claim on the user's JWT issued after login. | ||
Optional: Pass an arbitrary object to data.attributes.metadata which will be made available as a claim on the user's JWT issued after login, this claim is changable using the user token. Pass an arbitrary object to data.attributes.app which will be made available as a claim on the user's JWT issued after login, this claim is changable only using the admin token (aka a "private" claim). | ||
|
||
**PATCH** Request Body: | ||
|
||
|
@@ -182,8 +194,11 @@ Pass an arbitrary object to data.attributes.metdata which will be made available | |
"password": "supersecret", | ||
"active": 1, | ||
"metadata": { | ||
"tenant": "tenantID", | ||
}, | ||
"tenant": "tenantID" | ||
}, | ||
"app": { | ||
"tenantID": "1234" | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -200,8 +215,11 @@ Response: | |
"name": "Authy Person", | ||
"email": "[email protected]", | ||
"metadata": { | ||
"tenant": "tenantID", | ||
}, | ||
"tenant": "tenantID" | ||
}, | ||
"app": { | ||
"tenantID": "1234" | ||
}, | ||
"active": 1, | ||
"created": "2023-02-02T21:33:53.926Z", | ||
"updated": "2023-02-02T21:33:53.926Z" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ Returns Content-Type: application/json | |
|
||
Description: Register a user. Returns a JWT access token and sets a refresh token (as a http only cookie). JWTs are used by your web application to authenticate a user with your backend APIs. | ||
|
||
Optional: Pass an arbitrary object to data.attributes.metdata which will be made available as a claim on the user's JWT issued after login. | ||
Optional: Pass an arbitrary object to data.attributes.metdata which will be made available as a claim on the user's JWT issued after login (aka a "public" claim). | ||
|
||
**POST** Request Body: | ||
|
||
|
@@ -29,8 +29,8 @@ Optional: Pass an arbitrary object to data.attributes.metdata which will be made | |
"name": "Authy Person", | ||
"email": "[email protected]", | ||
"password": "mysecretpass", | ||
"metadata": { | ||
"tenant": "tenantID" | ||
"metadata": { | ||
"company": "Auth Co" | ||
} | ||
} | ||
} | ||
|
@@ -105,7 +105,7 @@ Bearer Token Required: `Authorization: Bearer {user's access token}` | |
|
||
All fields in the user's attributes are optional. | ||
|
||
Pass an arbitrary object to data.attributes.metdata which will be made available as a claim on the user's JWT issued after login. | ||
Optional: Pass an arbitrary object to data.attributes.metdata which will be made available as a claim on the user's JWT issued after login. | ||
|
||
**POST** Request Body: | ||
|
||
|
@@ -118,7 +118,7 @@ Pass an arbitrary object to data.attributes.metdata which will be made available | |
"email": "[email protected]", | ||
"password": "mysecretpass", | ||
"metadata": { | ||
"tenant": "tenantID" | ||
"company": "Auth Co" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
BEGIN TRANSACTION; | ||
|
||
ALTER TABLE users ADD COLUMN appdata text; | ||
|
||
UPDATE authc_version SET version = 4 WHERE version = 3; | ||
|
||
COMMIT TRANSACTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters