简体   繁体   中英

What's the format of sid issued by IdentityServer4?

Out of the tokens issued by Thinktecture IdentityServer4, there is one called sid - the session id. In my application, I would like to link this id with some of my other logics. But I am not sure if I can assume it's always a GUID string. I tested a few. They are all valid GUIDs. Just wondering if my assumption is right.

I looked into the source code of IdentityServer4 and found out the sid is generated by:

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

According to this link, the result can be parsed as a GUID.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM