修改webscort健全
This commit is contained in:
parent
3a5d69737a
commit
d1b230f5ff
|
@ -37,6 +37,9 @@ public class PermissionMiddleware(
|
||||||
//Cookie token
|
//Cookie token
|
||||||
var cookieToken = context.Request.Cookies["token"];
|
var cookieToken = context.Request.Cookies["token"];
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(cookieToken))
|
||||||
|
{
|
||||||
|
cookieToken = context.Request.Query["access_token"];
|
||||||
if (string.IsNullOrEmpty(cookieToken))
|
if (string.IsNullOrEmpty(cookieToken))
|
||||||
{
|
{
|
||||||
//如果Cookie中也没有Token,则返回401 Unauthorized
|
//如果Cookie中也没有Token,则返回401 Unauthorized
|
||||||
|
@ -44,6 +47,7 @@ public class PermissionMiddleware(
|
||||||
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
token = cookieToken;
|
token = cookieToken;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://192.168.0.13:58826",
|
"applicationUrl": "http://127.0.0.1:58826",
|
||||||
"sslPort": 44304
|
"sslPort": 44304
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": false,
|
"launchBrowser": false,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "http://192.168.0.13:5253",
|
"applicationUrl": "http://127.0.0.1:5253",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://192.168.0.13:7233;http://192.168.0.13:5253",
|
"applicationUrl": "https://127.0.0.1:7233;http://127.0.0.1:5253",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,9 @@ export const useSessionSignalRStore = defineStore('sessionSignalR', {
|
||||||
initConnection() {
|
initConnection() {
|
||||||
// 构建连接
|
// 构建连接
|
||||||
this.connection = new HubConnectionBuilder()
|
this.connection = new HubConnectionBuilder()
|
||||||
.withUrl(`${useRuntimeConfig().public.baseUrl}/SessionHub`)
|
.withUrl(`${useRuntimeConfig().public.baseUrl}/SessionHub`,{
|
||||||
|
accessTokenFactory:()=> `${useCookie('token').value}`
|
||||||
|
})
|
||||||
.withAutomaticReconnect()
|
.withAutomaticReconnect()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue