public async Task <IActionResult> GetUserInfoAsync([FromHeader(Name = "JSessionID")] string jsessionid, [FromHeader(Name = "Username")] string username, [FromHeader(Name = "Password")] string password)
        {
            try
            {
                var student = await _infoService.GetUserInfo(jsessionid, username, password);

                return(Ok(student));
            } catch (LoginFailException)
            {
                return(BadRequest("Login failed"));
            }
        }
Esempio n. 2
0
        /// <inheritdoc />
        public void Login(Action <Notification> callback)
        {
            // Temporarily register with the browser stack
            // for the info service domain.
            var infoServiceAddressString =
                mApolloServicesLocations.InfoServiceUri.ToString();

            WebRequest.RegisterPrefix(
                infoServiceAddressString, WebRequestCreator.BrowserHttp);
            var myAsyncActions = mAsyncActionsFactory.Create <IUserLoginInfo>(
                success: successAction => callback(null),
                failure: (y, z) => LoginFailure(callback, y, z));

            mServiceInvoker.CallService(
                myAsyncActions, serviceActions => mInfoService.GetUserInfo(
                    mUserCredentials.UserName, mUserCredentials.Password,
                    serviceActions), "BrowserStackLoginHelper: Login");

            // Set back to the standard.
            WebRequest.RegisterPrefix(infoServiceAddressString,
                                      mCookieContainerSpecificWebRequestCreator);
        }