Пример #1
0
 public Login(
     IServerConnection serverConnection,
     ICurrentContext currentContext,
     IHashService hashService,
     LoginInformations loginInformations,
     IEventAggregator eventAggregator)
 {
     _serverConnection  = serverConnection;
     _currentContext    = currentContext;
     _hashService       = hashService;
     _loginInformations = loginInformations;
     _eventAggregator   = eventAggregator;
 }
Пример #2
0
 public Login(
     IServerConnection serverConnection,
     ICurrentContext currentContext,
     IHashService hashService,
     LoginInformations loginInformations,
     IEventAggregator eventAggregator)
 {
     _serverConnection = serverConnection;
     _currentContext = currentContext;
     _hashService = hashService;
     _loginInformations = loginInformations;
     _eventAggregator = eventAggregator;
 }
Пример #3
0
        public HttpResponseMessage Login(LoginInformations loginInformations)
        {
            var authResult = apiClient.AuthenticateUser(
                loginInformations.Username,
                loginInformations.Password);

            var message = new HttpResponseMessage(authResult.StatusCode);

            if (authResult.StatusCode != HttpStatusCode.OK)
            {
                message.Content = new StringContent(authResult.ErrorMessage);
                return(message);
            }
            return(Request.CreateResponse(HttpStatusCode.OK,
                                          new Credentials
            {
                UserId = authResult.UserId,
                AccessToken = apiClient.AccessToken
            },
                                          Configuration.Formatters.JsonFormatter));
        }