Пример #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private static IApiResponse GetLogin(IApiRequest pApiReq)
        {
            string incomingError = pApiReq.GetQueryValue("error", false);

            if (incomingError != null)
            {
                string errDesc = pApiReq.GetQueryValue("error_description", false);

                return(new ApiResponse {
                    Html = new LoginErrorView(incomingError, errDesc).ToHtml()
                });
            }

            ////

            Action <IApiResponse> getResp = (apiResp => {
                string respType = pApiReq.GetQueryValue(LoginResponseTypeParam, false);
                string clientId = pApiReq.GetQueryValue(LoginClientIdParam, false);
                string redirUri = pApiReq.GetQueryValue(LoginRedirectUriParam, false);
                string switchMode = pApiReq.GetQueryValue(LoginSwitchModeParam, false);

                var op = new OauthLoginGetOperation();
                OauthLoginResult result = op.Execute(pApiReq.OpCtx, new OauthLoginTasks(),
                                                     clientId, redirUri, respType, switchMode);

                if (result.ShowLoginPage)
                {
                    apiResp.Html = new LoginPageView(result).ToHtml();
                    return;
                }

                if (result.Code != null)
                {
                    apiResp.RedirectUrl = BuildRedirectUri(result.Redirect, result.Code,
                                                           pApiReq.GetQueryValue(LoginStateParam, false));
                    return;
                }

                apiResp.Html = new LoginScopeView(result).ToHtml();
            });

            var exec = new CustomExecutor(pApiReq, getResp, OnLoginException);

            return(exec.Execute());
        }
Пример #2
0
 /*--------------------------------------------------------------------------------------------*/
 private void DoExecute()
 {
     vExecuteResult = vOper.Execute(vMockOpCtx.Object, vMockTasks.Object,
                                    vClientId, vRedirUri, vRespType, vSwitchMode);
 }
Пример #3
0
        /*--------------------------------------------------------------------------------------------*/
        private OauthLoginResult ExecuteOperation()
        {
            var op = new OauthLoginGetOperation();

            return(op.Execute(OpCtx, vTasks, vClientId, vRedirUri, vRespType, vSwitchMode));
        }