예제 #1
0
        public async Task LogoutAsync_SessionExists_ShouldReturnOne()
        {
            // Arrange
            expectedResult = 1;
            context.Add(expectedSession);
            context.SaveChanges();

            //Act
            var actualResult = await repository.LogoutAsync(expectedSession.Token);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
예제 #2
0
        public async Task <string> LogoutAsync(string token)
        {
            string logoutUrl = string.Empty;

            if (!string.IsNullOrWhiteSpace(token))
            {
                var schema   = configuration.AuthenticationSchema;
                var rawToken = token.Replace(schema, "");
                await repository.LogoutAsync(rawToken);

                logoutUrl = configuration.LogoutRedirectUrl;
            }
            else
            {
                throw  new InvalidCredentialException();
            }

            return(logoutUrl);
        }