Example #1
0
        public async Task When_Pass_Empty_Access_Token_Then_Exception_Is_Thrown()
        {
            // ARRANGE
            InitializeFakeObjects();

            // ACT & ASSERT
            await Assert.ThrowsAsync <ArgumentNullException>(() => _getJwsPayload.Execute(null));
        }
Example #2
0
        public async Task <UserInfoResult> GetUserInformation(string accessToken)
        {
            var processId = Guid.NewGuid().ToString();

            try
            {
                _eventPublisher.Publish(new GetUserInformationReceived(Guid.NewGuid().ToString(), processId, _payloadSerializer.GetPayload(accessToken), 0));
                var result = await _getJwsPayload.Execute(accessToken);

                _eventPublisher.Publish(new UserInformationReturned(Guid.NewGuid().ToString(), processId, _payloadSerializer.GetPayload(result), 1));
                return(result);
            }
            catch (IdentityServerException ex)
            {
                _eventPublisher.Publish(new OpenIdErrorReceived(Guid.NewGuid().ToString(), processId, ex.Code, ex.Message, 1));
                throw;
            }
        }