Beispiel #1
0
        public async Task <ResponseFromApi <string> > LoginLdapAsync(string email, string password)
        {
            LoginLdapRequest loginLdapRequest = new LoginLdapRequest()
            {
                Email = email, Password = password
            };

            var authResponse = await _authClient.LdapAsync(loginLdapRequest);

            if (authResponse.Token != string.Empty)
            {
                _localStorage.Store("token", authResponse.Token);

                _logger.LogInformation("Token is generated.");

                return(new ResponseFromApi <string>()
                {
                    Success = true, Data = authResponse.Token
                });
            }

            _logger.LogError("Token is not generated.");

            return(new ResponseFromApi <string>()
            {
                Success = false
            });
        }
        public async Task <ActionResult <AuthSuccessResponse> > LdapAuth([FromBody] LoginLdapRequest request)
        {
            _logger.LogInformation("Invoked LdapAuth endpoint");

            var authResponse = await _identityService.LoginLdap(request.Email, request.Password);

            return(CheckAuthenticationResult(authResponse));
        }