Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 63c8d97

Browse files
Daniel Chenetsuo
authored andcommitted
Resolves Issue #13 domained audieneces
1 parent 7bcf891 commit 63c8d97

File tree

5 files changed

+236
-74
lines changed

5 files changed

+236
-74
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,25 @@ The key is the shared secret with the issuer. It's a 32 character key. Remember,
4848

4949
This shouldn't need to be stated: don't commit your production private keys to your repo. Instead, inject them during deployment. How you do this is beyond the scope of this readme. This, by the way, is why you don't provide your key via the `authOptions` above. By putting it in your config files, you're able to create a config file for production that takes an environmental variable instead of having the key hard coded.
5050

51+
## domained Audience
52+
There will be times when in a multi tenanted environment when you will want to have a server authenticate on those different domains. Each domain will have the 3-tuple of `audience`-`issuer`-`key`. This auth-audience plugin is able to handle multiple domains (i.e., depending on the domain in the JWT, determining if the audience is supported and if the JWT signs correctly with the secret key for that audience given the domain)
53+
```
54+
jwt: {
55+
domainedAudiences: {
56+
"field": {
57+
audience: "audience1.somedomain.somewhere",
58+
issuer: "issuer1.somedomain.somewhere",
59+
key: "123"
60+
},
61+
"default": {
62+
audience: "audience2.somedomain.somewhere",
63+
issuer: "issuer2.somedomain.somewhere",
64+
key: "456"
65+
}
66+
}
67+
}
68+
```
69+
5170
# Use
5271
`auth-audience` exports `AuthAudience`. This can be used on your `@Routable` api calsses.
5372

package-lock.json

Lines changed: 12 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
"homepage": "https://github.com/sakuraapi/auth-audience#readme",
4747
"devDependencies": {
48-
"@sakuraapi/core": "^0.19.4",
48+
"@sakuraapi/core": "^0.19.5",
4949
"@types/express": "^4.16.0",
5050
"@types/jasmine": "^2.8.8",
5151
"@types/jsonwebtoken": "^7.2.8",
@@ -64,6 +64,7 @@
6464
"dependencies": {
6565
"colors": "^1.3.1",
6666
"jsonwebtoken": "^8.3.0",
67+
"mongodb": "^3.1.3",
6768
"urlsafe-base64": "^1.0.0",
6869
"uuid": "^3.3.2"
6970
},

0 commit comments

Comments
 (0)