Esempio n. 1
0
        public void When_Requesting_ClientId_And_Instruction_Is_Null_Then_Exception_Is_Thrown()
        {
            // ARRANGE
            InitializeFakeObjects();

            // ACT & ASSERT
            Assert.Throws <ArgumentNullException>(() => _clientSecretPostAuthentication.GetClientId(null));
        }
        /// <summary>
        /// Try to get the client id from the HTTP body or HTTP header.
        /// </summary>
        /// <param name="instruction">Authentication instruction</param>
        /// <returns>Client id</returns>
        private string TryGettingClientId(AuthenticateInstruction instruction)
        {
            var clientId = _clientAssertionAuthentication.GetClientId(instruction);

            if (!string.IsNullOrWhiteSpace(clientId))
            {
                return(clientId);
            }

            clientId = _clientSecretBasicAuthentication.GetClientId(instruction);
            if (!string.IsNullOrWhiteSpace(clientId))
            {
                return(clientId);
            }

            return(_clientSecretPostAuthentication.GetClientId(instruction));
        }