codejump

Advanced Security Decisions — Series 2

Preview — 3 of 10 questions

An endpoint uses Depends(get_user) while another uses Security(get_user, scopes=["files:read"]). What additional metadata does the second declaration supply?

AA scope requirement for that dependency path and its OpenAPI security scheme
BA verified files:read grant in every incoming token
CA new database user for each request
DAn application-wide requirement on unrelated routes

Two routes use the same authentication function but declare different scopes with Security. Why cannot a single hard-coded allowed-scope list replace SecurityScopes?

AIt would encrypt the JWT
BIt would ignore route-specific requirements
CIt would disable /docs
DIt would turn a 401 into 200

A token lists scope="items:read items:write". The current route requires only items:read. What should a scope validator do after validating the token?

AReject because the token has an extra write grant
BGrant access without checking any scope
CConfirm that the required read scope is present
DReplace the route requirement with write

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.