wip: oauth

This commit is contained in:
2024-10-13 22:12:43 +07:00
parent e9f32fc32e
commit b7150c7c43
14 changed files with 234 additions and 65 deletions

View File

@@ -41,18 +41,18 @@ builder.Services.AddAuthentication()
}
};
// b.Events = new JwtBearerEvents()
// {
// OnMessageReceived = (ctx) =>
// {
// if (ctx.Request.Query.ContainsKey("token"))
// {
// ctx.Token = ctx.Request.Query["token"];
// }
//
// return Task.CompletedTask;
// }
// };
b.Events = new JwtBearerEvents()
{
OnMessageReceived = (ctx) =>
{
if (ctx.Request.Query.ContainsKey("token"))
{
ctx.Token = ctx.Request.Query["token"];
}
return Task.CompletedTask;
}
};
});
builder.Services.AddAuthorization();

View File

@@ -12,8 +12,7 @@
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -22,8 +21,7 @@
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5000;http://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"