codejump

Advanced Security Decisions

Preview — 3 of 10 questions

A route uses Security(get_user, scopes=["items"]), and an inner security dependency requires me. What must the validator enforce?

ABoth declared scopes after validating the token
BOnly the first scope listed on the route
COnly the scope nearest the token decoder
DNeither, because OpenAPI enforces them

What does SecurityScopes give an authentication dependency?

AScopes already cryptographically verified in the token
BRequired scopes declared by the current dependency path
CThe user's database role automatically
DEvery scope defined anywhere in the app

A token is valid for tenant A but requests /tenants/B/data. What must authorization examine?

AOnly whether the token has any signature
BOnly whether the URL is in OpenAPI
CWhether the subject may access tenant B and that resource
DOnly whether the token has not expired

Sign up free to play

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