/// <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()); }
/// <inheritdoc /> public ICollection <string> GetAllIdTokensAsString() { return(_tokenCacheAccessor.GetAllIdTokensAsString()); }