Exemplo n.º 1
0
        public Task <AuthenticationResult> AuthenticationUserAsync(MdmAuthenticationInput input)
        {
            var tcs = new TaskCompletionSource <AuthenticationResult>();

            try {
                var auth     = CreateAuthenticateUserInput(input);
                var response = Client.authenUser(auth);
                var result   = _mapper.Map <AuthenticationResult>(response);
                result.IsSuccess = true;

                tcs.TrySetResult(result);
            }
            catch (SoapException soapex)
            {
                tcs.TrySetResult(new AuthenticationResult()
                {
                    IsSuccess  = false,
                    LoginToken = null,
                    Message    = soapex.Message
                });
            }

            catch (Exception ex)
            {
                tcs.TrySetException(ex);
            }

            return(tcs.Task);
        }
Exemplo n.º 2
0
        private authenUser CreateAuthenticateUserInput(MdmAuthenticationInput input)
        {
            var auth = new authenUser();

            auth.AuthenUserInput = new AuthenUserInput()
            {
                authenUserBeanInput = _mapper.Map <authenUserBean>(_mdmServiceConfiguration),
                authenticationInput = _mapper.Map <AuthenticationInput>(input)
            };

            return(auth);
        }
Exemplo n.º 3
0
        public Task <MdmUserInfo> GetUserInfoAsync(MdmAuthenticationInput input)
        {
            return(AuthenticationUserAsync(input).ContinueWith(t =>
            {
                if (t.Result != null)
                {
                    return GetUserInfoAsync(new MdmGetUserInfoInput()
                    {
                        Token = t.Result.LoginToken,
                        AuthenticationUser = input
                    });
                }

                return null;
            }).Unwrap());
        }