Beispiel #1
0
        public static TokenCache GetAdalTokenCache(ILogger logger)
        {
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                logger.Verbose(Resources.DPAPIUnavailableNonWindows);
                return(TokenCache.DefaultShared);
            }

            if (!EnvUtil.AdalFileCacheEnabled())
            {
                logger.Verbose(Resources.AdalFileCacheDisabled);
                return(TokenCache.DefaultShared);
            }

            logger.Verbose(string.Format(Resources.AdalFileCacheLocation, EnvUtil.AdalTokenCacheLocation));
            return(new AdalFileCache(EnvUtil.AdalTokenCacheLocation));
        }