Support for Non-401 Error Codes from the validateFunc
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, node.js
- Ambito
- authentication
Direzione di ricerca
Inizia leggendo la gestione di validateFunc nel plugin dei cookie e confrontala con il comportamento di validate di @hapi/basic descritto nell'issue. Il lavoro è completato quando la validazione può restituire un errore Boom diverso da 401, ad esempio 403 Forbidden, per un cookie non valido per la regione richiesta, con test che coprano lo stato della risposta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Support plan
- is this issue currently blocking your project? (yes/no): No
- is this issue affecting a production system? (yes/no): No
Context
- node version:
v14.17.0 - module version:
11.0.2 - environment (e.g. node, browser, native): Node
- used with (e.g. hapi application, another framework, standalone, ...): Hapi application (Hapi version =
20.2.1) - any other relevant information:
What problem are you trying to solve?
I have a system that involves multiple different "regions" of authorization, I want a cookie to only be valid for one of these "regions", and I have added validation checks into the validateFunc. I would love be able to respond to the client with a 403 Forbidden when the cookie provided is for a different "region" than that which it is trying to access.
Example:
I have "regions" 1 and 2, and an authorization cookie is used for region 1, but the user is making a request to GET /region/2 I would like to be able to throw boom.forbidden(), and it set the response code to 403 instead of the plugin only throwing 401 to the user.
Do you have a new or modified API suggestion to solve the problem?
I think a solution following a similar vein as to how @hapi/basic does it where if the validateFunc throws an error(/Boom error) it replaces the default boom.unauthorized()
From the @hapi/basic API documentation for the validate function:
- Throwing an error from this function will replace default
Boom.unauthorizederror
- Lingua principale
- JavaScript
- Stelle
- 229
- Fork
- 99
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi 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 hapijs/cookie
-
support
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
ttl和keepAlive功能存在bugApertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
support
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
support
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
-
support
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
Tutte le issue di hapijs/cookie
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
obsidianmd/obsidian-help#1169 ·
I maintainer di solito rispondono entro 2 giorni
-
[docs] RELEASE.md: wrong branch name, no check that the prepare PR merged with the right subject, manual publish stepForse già presa @albertteoh l’ha presa oggi. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
jaegertracing/jaeger-ui#4739 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
keepassxreboot/keepassxc-browser#3159 · 1 commento ·
-
Add: ESP 2 RSApertaapproved check:passed feeds:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100