public Task <bool> RevokeToken( RevokeTokenParameter revokeTokenParameter, AuthenticationHeaderValue authenticationHeaderValue) { if (revokeTokenParameter == null) { throw new ArgumentNullException(nameof(revokeTokenParameter)); } var processId = Guid.NewGuid().ToString(); try { _eventPublisher.Publish(new RevokeTokenReceived(Guid.NewGuid().ToString(), processId, _payloadSerializer.GetPayload(revokeTokenParameter, authenticationHeaderValue), authenticationHeaderValue, 0)); _simpleIdentityServerEventSource.StartRevokeToken(revokeTokenParameter.Token); var result = _revokeTokenAction.Execute(revokeTokenParameter, authenticationHeaderValue); _simpleIdentityServerEventSource.EndRevokeToken(revokeTokenParameter.Token); _eventPublisher.Publish(new TokenRevoked(Guid.NewGuid().ToString(), processId, 1)); return(result); } catch (IdentityServerException ex) { _eventPublisher.Publish(new OpenIdErrorReceived(Guid.NewGuid().ToString(), processId, ex.Code, ex.Message, 1)); throw; } }
public async Task When_Passing_Null_Parameter_Then_Exceptions_Are_Thrown() { // ARRANGE InitializeFakeObjects(); // ACTS & ASSERTS await Assert.ThrowsAsync <ArgumentNullException>(() => _revokeTokenAction.Execute(null, null, null, null)); await Assert.ThrowsAsync <ArgumentNullException>(() => _revokeTokenAction.Execute(new RevokeTokenParameter(), null, null, null)); }