上下文
使用Safari(IOS和MacOS)通过HTTPS(两者一起)使用Authorization标头的XHR请求不会到达服务器.但它适用于IE,Chrome和Firefox.
我使用由Letsencrypt生成的有效证书,浏览器不显示有关它的警告.
在Safari的Web检查器上,这些XHR尝试获取结果直到超时并且不显示错误.
我有一个域名,没有子域名.
测试
码
我使用拦截器来设置授权头.
this.request = (config) => {
config.headers = config.headers || {};
var authData = localStorageService.get('authorizationData');
if (authData && config.url && !config.url.endsWith("/token")) {
config.headers = {
"Authorization": 'Bearer ' + authData.access_token
};
config.withCredentials = true;
}
return config;
}
Run Code Online (Sandbox Code Playgroud)
有谁遇到过同样的问题?
更新1
Safari + HTTPS +"授权"标题有问题.如果我通过"MyHeader"重命名"Authorization",并在服务器上进行一些修改以使用"MyHeader"令牌检索我的持有者令牌,那么一切都运行良好.
在"safari"中使用HTTPS,"授权"标题是受保护的单词吗?
我配置IdentityServer4为使用 AspNet Identity (.net core 3.0) 以允许用户进行身份验证(登录名/密码)。
我的第三个应用程序是.net core 3.0.
登录后,身份验证和授权成功,但我无法通过 User.Identity.Name 检索 UserId,它为空/空。
但是,我可以看到包含sub包含 userId的声明的声明信息。
这是我用于 IdentityServer4 Web 应用程序的包
PackageReference Include="IdentityServer4" Version="3.0.1" />
Run Code Online (Sandbox Code Playgroud) 语境
我正在将 SignalR 3 RC1 与 ASP.NET 5 用于我的项目,但我无法让我的客户端订阅特定组,以从我的服务器接收消息。
枢纽类
[HubName("ChatHub")]
public class ChatHub : Hub
{
public async Task Join(string userId)
{
if (!string.IsNullOrEmpty(userId))
{
await Groups.Add(Context.ConnectionId, userId);
}
}
}
Run Code Online (Sandbox Code Playgroud)
JS代码
var chatHub = hubConnection.createHubProxy("chatHub");
chatHub .on("newMessage", (response) => {
console.log(response);
});
hubConnection.start().done(response => {
chatHub.invoke("join", "userid");
});
Run Code Online (Sandbox Code Playgroud)
网络接口
public class ChatController : ApiController
{
protected readonly IHubContext ChatHub;
public ChatController(IConnectionManager signalRConnectionManager)
{
ChatHub = signalRConnectionManager.GetHubContext<ChatHub>();
}
[Authorize]
[HttpPost]
[Route("Message")]
public async Task<IActionResult> CreateMessage([FromBody] messageParams dto)
{
await …Run Code Online (Sandbox Code Playgroud) 我想为我的.NET Core项目安装phantomJS nuget包.此nuget包中包含.exe文件(phantomjs.exe).(C:\用户\ .nuget \包\ PhantomJS\2.1.1\TOOLS\phantomjs)
构建或发布解决方案不会将bin文件或发布文件夹中的.exe文件复制.
我是否必须在project.json中添加特定配置,以便在我发布或构建时自动复制.exe?
我尝试使用 JEKYLL_ENV 变量在生产模式下构建我的 jekyll 项目,但它不起作用。
Jekyll 文档指定production在构建命令中设置环境:
JEKYLL_ENV=production jekyll build
Run Code Online (Sandbox Code Playgroud)
但是在 Windows 上,这种类型的语法是不正确的。我使用了以下语法,但它看起来不起作用:
jekyll build JEKYLL_ENV=production
Run Code Online (Sandbox Code Playgroud)
我还“手动”设置了这个环境变量,但没有生效:
setx JEKYLL_ENV production & jekyll build
Run Code Online (Sandbox Code Playgroud)
和
set JEKYLL_ENV=production & jekyll build
Run Code Online (Sandbox Code Playgroud)