mirror of
https://github.com/notrab/dumbo.git
synced 2025-01-16 21:58:25 +01:00
Doc Improvement: Rename variable c/ctx with context (#26)
This commit is contained in:
parent
9389fdd0ab
commit
3f7bf80329
@ -131,7 +131,7 @@ $protectedRoutes->use(BearerAuth::bearerAuth($token, 'Unauthorized request.'));
|
||||
|
||||
// Custom token verification function
|
||||
$app->use(BearerAuth::bearerAuth([
|
||||
'verifyToken' => function($token, $ctx) {
|
||||
'verifyToken' => function($token, $context) {
|
||||
// Perform custom token verification logic
|
||||
return verifyJWT($token);
|
||||
},
|
||||
@ -210,7 +210,7 @@ $app->use(BasicAuth::basicAuth("user:password"));
|
||||
|
||||
// Use case 2: Dynamic verification
|
||||
$app->use(BasicAuth::basicAuth([
|
||||
"verifyUser" => function ($username, $password, $ctx) {
|
||||
"verifyUser" => function ($username, $password, $context) {
|
||||
// You could call a database here...
|
||||
$validUsers = [
|
||||
"admin" => "strongpassword",
|
||||
@ -235,7 +235,7 @@ $app->use(BasicAuth::basicAuth([
|
||||
);
|
||||
|
||||
// Define routes for the above three use cases
|
||||
$app->get("/", function (Context $ctx) {
|
||||
$app->get("/", function (Context $context) {
|
||||
return $context->json([
|
||||
"status" => 'success',
|
||||
"message" => "Your authentication is successful!!!"
|
||||
@ -276,7 +276,7 @@ $app->use(RequestId::requestId());
|
||||
// RequestId::requestId([
|
||||
// "headerName" => "X-Custom-Request-Id",
|
||||
// "limitLength" => 128,
|
||||
// "generator" => function ($ctx) {
|
||||
// "generator" => function ($context) {
|
||||
// return uniqid("custom-", true);
|
||||
// },
|
||||
// ])
|
||||
|
Loading…
x
Reference in New Issue
Block a user