FastAPI - Authentication and Security
Given this FastAPI code snippet, what will happen if a user without the 'editor' role tries to access the endpoint?
async def editor_access(user: User = Depends(get_current_user)):
if 'editor' not in user.roles:
raise HTTPException(status_code=403, detail='Forbidden')
@app.get('/edit')
async def edit_page(dep=Depends(editor_access)):
return {'message': 'Welcome editor'}