Verify: allow passing a function to `audience`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- authentication
Direzione di ricerca
Parti dal punto di ingresso jwt.verify() e segui come viene utilizzata l’opzione audience, incluso il passaggio attraverso jwt-express descritto qui. Usa l’esempio delle audience dinamiche per chiarire la forma di ritorno supportata dalla funzione per una stringa o un array, e aggiungi una copertura che dimostri che i valori modificati vengono rilevati senza riavviare l’app.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the problem you'd like to have solved
We have a use case where our audience list comes from AWS Parameter Store and could be changed on the fly without having to restart the whole app.
Describe the ideal solution
It would be ideal to be able to pass a function that return the audience(s). Something like this;
// This could be updated elsewhere.
// Could be an array ['audience1', 'audience2'] or just a string.
let audiences = []; ;
jwt.verify(token, secretOrPublicKey, {
audience: function() {
return audiences; return the reference to the list.
}
});
Alternatives and current work-arounds
We actually are not calling jwt.verify() directly but uses jwt-express to create a middleware for token verification. jwt-express passes through the audience option to jwt.verify() internally. Here's what we currently have:
app.use(jwtExpress({ audience: audiences }));
The middleware only gets the copy of the list at the time the app starts. We could wrap the jwtExpress middleware inside another middleware that always returns the current copy of the audiences list, but it would be an ugly solution.
- Lingua principale
- JavaScript
- Stelle
- 18.2k
- Fork
- 1.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di auth0/node-jsonwebtoken
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
auth0/node-jsonwebtoken#1042 · 1 commento ·
-
`jwt.sign()` callback is executed twice for "The payload already has an "..." property" errors Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
auth0/node-jsonwebtoken#1000 · 2 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 65/100
auth0/node-jsonwebtoken#1046 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
auth0/node-jsonwebtoken#1034 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
auth0/node-jsonwebtoken#1032 ·
Tutte le issue di auth0/node-jsonwebtoken
Issue simili
-
Update HugeIcons library Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
antfu-collective/icones#398 ·
-
ECmail.com Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
wesbos/burner-email-providers#554 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
components-web-app/docs#92 ·