internal TokenCache(TokenCachePersistenceOptions options, MsalCacheHelperWrapper cacheHelperWrapper, Func <IPublicClientApplication> publicApplicationFactory = null) { _cacheHelperWrapper = cacheHelperWrapper ?? new MsalCacheHelperWrapper(); _publicClientApplicationFactory = publicApplicationFactory ?? new Func <IPublicClientApplication>(() => PublicClientApplicationBuilder.Create(Guid.NewGuid().ToString()).Build()); if (options is UnsafeTokenCacheOptions inMemoryOptions) { TokenCacheUpdatedAsync = inMemoryOptions.TokenCacheUpdatedAsync; RefreshCacheFromOptionsAsync = inMemoryOptions.RefreshCacheAsync; _lastUpdated = DateTimeOffset.UtcNow; _cacheAccessMap = new ConditionalWeakTable <object, CacheTimestamp>(); } else { _allowUnencryptedStorage = options?.UnsafeAllowUnencryptedStorage ?? false; _name = options?.Name ?? Constants.DefaultMsalTokenCacheName; _persistToDisk = true; } }
/// <summary> /// Creates a new instance of <see cref="TokenCache"/> with the specified options. /// </summary> /// <param name="options">Options controlling the storage of the <see cref="TokenCache"/>.</param> public TokenCache(TokenCachePersistenceOptions options = null) : this(options, default, default) { }