/// <summary>
        /// Serializes the entire token cache
        /// </summary>
        /// <param name="tokenCacheAccessor">Token cache accessor to perform cache read operations</param>
        /// <returns>array of bytes containing the serialized cache</returns>
        internal static byte[] SerializeUnifiedCache(ITokenCacheAccessor tokenCacheAccessor)
        {
            // reads the underlying in-memory dictionary and dumps out the content as a JSON
            Dictionary <string, IEnumerable <string> > cacheDict = new Dictionary <string, IEnumerable <string> >
            {
                [AccessTokenKey]  = tokenCacheAccessor.GetAllAccessTokensAsString(),
                [RefreshTokenKey] = tokenCacheAccessor.GetAllRefreshTokensAsString(),
                [IdTokenKey]      = tokenCacheAccessor.GetAllIdTokensAsString(),
                [AccountKey]      = tokenCacheAccessor.GetAllAccountsAsString()
            };

            return(JsonHelper.SerializeToJson(cacheDict).ToByteArray());
        }
Beispiel #2
0
 /// <inheritdoc />
 public ICollection <string> GetAllIdTokensAsString()
 {
     return(_tokenCacheAccessor.GetAllIdTokensAsString());
 }