问题标签 [servicestack-auth]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
21 浏览

servicestack - 即使 UseDistinctRoleTables 为 false,也会创建 UserAuthRole

为角色使用单独的表时,例如UseDistinctRoleTables=false为什么UserAuthRole仍然创建表?我检查了源代码,它在很多地方都有 UseDistinctRoleTables 的 if 子句,但在InitSchema().

有未使用的空表会令人困惑。有目的吗,或者可以改变吗?

0 投票
1 回答
20 浏览

json - 为什么 UserAuthExtensions.PopulateFromMap(session, jwtPayload) 不能在 ServiceStack.Auth 中正确反序列化带有转义的 json 值?

我们想从 ServiceStack 会话中获取 UserName,但是我们发现 UserName 中的反斜杠没有按预期反序列化。用户名具有这种格式“域名\用户名”并在 jwt 令牌中序列化,如下所示:

调用后:

userName 变量包含值'domainname\\robindoe'而不是'domainname\robindoe'.

在挖掘 ServiceStack 代码之后,我们将其归结为https://github.com/ServiceStack/ServiceStack/blob/36df74a8b1ba7bf06f85262c1155e1425c082906/src/ServiceStack/Auth/UserAuth.cs#L388中的 PopulateFromMap() 方法。

为了演示这个问题,我们编写了一个小程序来证明这一点:

为什么 UserAuthExtensions.PopulateFromMap(session, jwtPayload) 不能在 ServiceStack.Auth 中正确反序列化带有转义的 json 值?