See which agent is calling#
Know the agent and its verified operator, before any person is involved.
| Level | 0: The agent identifies itself; no person is asked. |
| Class | read: Nothing changes. The approval can be reused until it ends or the person withdraws it. |
routes.append(route("GET", "/me", level=0, summary="Which agent is calling"))
@app.get("/me")
def me():
return {"agent": g.allowedby.agent, "operator": g.allowedby.operator}routes.push(route("GET", "/me", undefined, { level: 0, summary: "Which agent is calling" }));
api.get("/me", (req, res) => {
res.json({ agent: req.allowedby.agent, operator: req.allowedby.operator });
});routes = append(routes, allowedby.Route{Method: "GET", Path: "/me", Level: 0, Summary: "Which agent is calling"})
mux.HandleFunc("GET /me", func(w http.ResponseWriter, r *http.Request) {
who, _ := allowedby.ContextFrom(r.Context())
writeJSON(w, http.StatusOK, map[string]string{"agent": who.Agent, "operator": who.Operator})
})@Bean
AllowedByCustomizer identify() {
return aby -> aby.route(Route.get("/me").level(0).summary("Which agent is calling"));
}
@GetMapping("/me")
Map<String, String> me(@AllowedByContext Context ctx) {
return Map.of("agent", ctx.getAgent(), "operator", ctx.getOperator());
}routes.Add(Route("GET", "/me", level: 0, summary: "Which agent is calling"));
app.MapGet("/me", (AllowedByContext ctx) => new { agent = ctx.Agent, @operator = ctx.Operator });$routes[] = route('GET', '/me', level: 0, summary: 'Which agent is calling');
$app->get('/me', function (Request $request, Response $response) use ($json) {
$context = $request->getAttribute('allowedby.context');
return $json($response, ['agent' => $context->agent, 'operator' => $context->operator]);
});ROUTES << AllowedBy.route("GET", "/me", level: 0, summary: "Which agent is calling")
get "/me" do
context = env["allowedby.context"]
{ agent: context.agent, operator: context.operator }.to_json
endlet aby = aby.route(Route::get("/me").level(0).summary("Which agent is calling"));
let app = app.route("/me", get(me));
async fn me(ctx: AllowedByContext) -> Json<Value> {
Json(json!({"agent": ctx.agent, "operator": ctx.operator}))
}What the test proves#
- without a passport: 401 passport_required
- the app learns the agent and its verified operator; nobody is asked