【问题标题】:What's the format of sid issued by IdentityServer4?IdentityServer4发出的sid格式是什么?
【发布时间】:2018-01-30 16:40:44
【问题描述】:

在 Thinktecture IdentityServer4 发布的令牌中,有一个称为 sid - 会话 ID。在我的应用程序中,我想将此 id 与我的其他一些逻辑联系起来。但我不确定我是否可以假设它总是一个 GUID 字符串。我测试了几个。它们都是有效的 GUID。只是想知道我的假设是否正确。

【问题讨论】:

    标签: identityserver4 thinktecture


    【解决方案1】:

    我查看了IdentityServer4的源代码,发现sid是由以下生成的:

    public static string CreateUniqueId(int length = 16)
    {
        var bytes = new byte[length];
        new RNGCryptoServiceProvider().GetBytes(bytes);
        return ByteArrayToString(bytes);
    }
    

    根据this链接,可以将结果解析为GUID。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-15
      • 2014-12-28
      • 2011-09-25
      • 1970-01-01
      • 2012-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多