コード例 #1
0
        /// <inheritdoc />
        public void DeleteCachedRefreshToken()
        {
            string homeAccountId = _authParameters.Account.HomeAccountId.ToString();
            var    authority     = new Uri(_authParameters.Authority.CanonicalAuthority);
            string environment   = authority.GetEnvironment();
            string clientId      = _authParameters.ClientId;

            if (string.IsNullOrWhiteSpace(homeAccountId) || string.IsNullOrWhiteSpace(environment) ||
                string.IsNullOrWhiteSpace(clientId))
            {
                // warning failed to delete refresh token from cache, pk is empty
                return;
            }

            var status = _storageManager.DeleteCredentials(
                string.Empty,
                homeAccountId,
                environment,
                string.Empty,
                clientId,
                string.Empty,
                string.Empty,
                new HashSet <CredentialType>
            {
                CredentialType.OAuth2RefreshToken
            });

            if (status.StatusType != OperationStatusType.Success)
            {
                // warning, error deleting invalid refresh token from cache
            }
        }