IdentityServer4发布的sid格式是什么?

时间:2018-01-30 16:40:44

标签: identityserver4 thinktecture

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

1 个答案:

答案 0 :(得分:0)

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

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

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