Identityserver4 JS报表服务器控制台错误:授权服务器没有;用户名";字段,令牌被假定为无效

Identityserver4 JS报表服务器控制台错误:授权服务器没有;用户名";字段,令牌被假定为无效,identityserver4,jsreport,Identityserver4,Jsreport,带有客户端ui应用程序的My js report server正在使用提交的用户名,方法是在identityserver中添加一个声明,例如声明(“用户名”、“用户名值”)。 4第1.1版。但最近客户端已将identityserver 4版本升级为2.2.0和netcoreapp2.1 现在,客户端ui应用程序出现“未经授权”错误。在本地运行应用程序时,我在jsreport server控制台中看到一个错误: 错误:授权服务器的响应中没有“用户名”字段,令牌被假定为无效 我试图在样本中找到解决方

带有客户端ui应用程序的My js report server正在使用提交的用户名,方法是在identityserver中添加一个声明,例如声明(“用户名”、“用户名值”)。 4第1.1版。但最近客户端已将identityserver 4版本升级为2.2.0和netcoreapp2.1

现在,客户端ui应用程序出现“未经授权”错误。在本地运行应用程序时,我在jsreport server控制台中看到一个错误: 错误:授权服务器的响应中没有“用户名”字段,令牌被假定为无效

我试图在样本中找到解决方案: 但是他们还没有升级最新的.net core和identity server的示例,我看到节点js示例链接“”不存在。所以我无法解决这个问题。有人能帮我吗


提前感谢。

我找到了解决此错误的解决方案,添加了一个带有用户名的声明类型,并在api资源范围中声明:

         new ApiResource
            {
                Name="jsreportscope",
                DisplayName = "JavaScript based reporting platform",
                Scopes=
                {
                    new Scope()
                    {
                        Name="jsreportscope",
                        UserClaims = new List<string>(){"username" }
                    }
                },
                UserClaims = new List<string>(){"username"},
                ApiSecrets = { new Secret("yoursecret".Sha256()) },

            }
新资源
{
Name=“jsreportscope”,
DisplayName=“基于JavaScript的报告平台”,
范围=
{
新范围()
{
Name=“jsreportscope”,
UserClaims=new List(){“username”}
}
},
UserClaims=new List(){“username”},
ApiSecrets={newsecret(“yoursecret.Sha256())},
}
但现在转到上一个问题,我通过添加与identity server 1.1版本的用户名字段值的值匹配的声明类型来修复该问题,但现在我们已将identity server版本升级到2.1,并且再次出现错误。它能够授权identity server的任何用户访问报表。下面是我正在使用的jsreport.config.js代码:

{
   "store": { "provider": "fs" },
   "httpPort": 5004,
   "allowLocalFilesAccess": true,
   "extensions": {
    "authentication": {
       "cookieSession": {
       "secret": "<your strong secret>"
    },
    "admin": {
         "username": "IdentityServer4User@domain.com",
         "password": "Password"
    },
    "authorizationServer": {
       "tokenValidation": {
           "endpoint": "http://localhost:5000/connect/introspect",
           "usernameField": "username",
           "activeField": "active",
        "scope": {
           "valid": ["jsreportscope"]
        },
        "auth": {
           "type": "basic",
           "basic": {
               "clientId": "jsreport",
               "clientSecret": "yoursecret"
           }
        }
      }
    },
    "enabled": true
   },
   "authorization": {
     "enabled": true
   },
   "sample-template": {
      "createSamples": true
   }
 }
} 
{
“存储”:{“提供程序”:“fs”},
“httpPort”:5004,
“allowLocalFilesAccess”:正确,
“扩展”:{
“身份验证”:{
“库克会议”:{
“秘密”:”
},
“管理员”:{
“用户名”:”IdentityServer4User@domain.com",
“密码”:“密码”
},
“授权服务器”:{
“令牌验证”:{
“端点”:http://localhost:5000/connect/introspect",
“用户名字段”:“用户名”,
“活动字段”:“活动”,
“范围”:{
“有效”:[“jsreportscope”]
},
“auth”:{
“类型”:“基本”,
“基本”:{
“客户端ID”:“jsreport”,
“客户秘密”:“你的秘密”
}
}
}
},
“已启用”:真
},
“授权”:{
“已启用”:真
},
“样本模板”:{
“createSamples”:true
}
}
} 
但是现在,如果仅由用户登录,我可以从报表服务器登录并访问报表IdentityServer4User@domain.com任何其他用户都出现未经授权的错误。在报表服务器控制台中,错误如下所示:
error: username "OtherIdentityServer4User@domain.com" returned from authorization server is not a jsreport user. 错误:用户名“OtherIdentityServer4User@domain.com“从授权服务器返回的不是jsreport用户。我不想将所有identity server用户添加到js报表服务器