/// <summary> /// 授权 /// </summary> /// <returns></returns> public ActionResult Access() { FormStringControl queryControl = new FormStringControl(Request.Url.Query); var clientID = queryControl.GetParamValue("client_id"); var userID = User.Identity.GetUserId(); _ticketStore.Set("TemporaryAuthorization" + clientID + "$" + userID, "", 2); return(Redirect(Url.Content("~/") + EndPointConfig.AuthorizeEndpointPath.TrimStart('/') + Request.Url.Query)); }
public ActionResult Index(UserDTO userParam) { if (!ModelState.IsValid) { return(View()); } var isRemenber = Request.Form["isRemenber"].Contains("true"); var roleName = Request.Form["ddl_Role"]; var result = _userService.Login(userParam.Name, userParam.Password); if (result.Success) { var user = result.Data; var cookiesIdentity = ClaimsIdentityCreate.GenerateUserIdentity(user, DefaultAuthenticationTypes.ApplicationCookie); var role = user.Roles.Select(s => s.Name).FirstOrDefault(t => t == roleName); if (string.IsNullOrEmpty(role)) { ModelState.AddModelError("", "角色选择不正确."); return(View()); } cookiesIdentity.AddRole(role); Request.GetOwinContext().Request.Context.Authentication.SignIn(new AuthenticationProperties { IsPersistent = isRemenber }, cookiesIdentity); var queryStr = Request.QueryString["Query"]; if (!string.IsNullOrEmpty(queryStr)) { FormStringControl queryControl = new FormStringControl(queryStr); if (queryControl.ContainParamName("ReturnUrl")) { return(Redirect(queryControl.GetParamValue("ReturnUrl"))); } } return(Redirect("~/Admin/Home")); } ModelState.AddModelError("", result.Message); return(View()); }
// GET: OAuth/Grant public ActionResult Index() { FormStringControl queryControl = new FormStringControl(Request.Url.Query); ViewBag.Scope = queryControl.GetParamValue("Scope");; var clientIDStr = queryControl.GetParamValue("client_id"); int clientID; if (string.IsNullOrEmpty(clientIDStr) || !int.TryParse(clientIDStr, out clientID)) { throw new BusinessException("client_id不存在."); } var app = _appService.Query(new AppDTO { ClientID = clientID }, null).ToList().FirstOrDefault(); if (app == null) { throw new BusinessException("该client_id不存在应用."); } ViewBag.AccessUrl = Url.Content("~/") + EndPointConfig.AuthorizeGrantAccess + Request.Url.Query; return(View(_typeAdapter.Adapt <AppDTO>(app))); }
/// <summary> /// Run the process /// </summary> public override void run() { // Caption this.form.FormDesign.Caption = this.labelManager.createLabel(this.form.FormDesign.Caption); // Form controls foreach (FormControl control in this.form.FormDesign.FormControls) { switch (control.Type) { case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.String: FormStringControl stringControl = control as FormStringControl; stringControl.Label = this.labelManager.createLabel(stringControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.CheckBox: FormCheckBoxControl checkboxControl = control as FormCheckBoxControl; checkboxControl.Label = this.labelManager.createLabel(checkboxControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Group: FormGroupControl groupControl = control as FormGroupControl; groupControl.Caption = this.labelManager.createLabel(groupControl.Caption); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Button: FormButtonControl buttonControl = control as FormButtonControl; buttonControl.Text = this.labelManager.createLabel(buttonControl.Text); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Real: FormRealControl realControl = control as FormRealControl; realControl.Label = this.labelManager.createLabel(realControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Integer: FormIntegerControl integerControl = control as FormIntegerControl; integerControl.Label = this.labelManager.createLabel(integerControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ComboBox: FormComboBoxControl comboboxControl = control as FormComboBoxControl; comboboxControl.Label = this.labelManager.createLabel(comboboxControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Image: FormImageControl imageControl = control as FormImageControl; imageControl.Label = this.labelManager.createLabel(imageControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Date: FormDateControl dateControl = control as FormDateControl; dateControl.Label = this.labelManager.createLabel(dateControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.RadioButton: FormRadioButtonControl radioControl = control as FormRadioButtonControl; radioControl.Caption = this.labelManager.createLabel(radioControl.Caption); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ButtonGroup: FormButtonGroupControl buttonGroupCaption = control as FormButtonGroupControl; buttonGroupCaption.Caption = this.labelManager.createLabel(buttonGroupCaption.Caption); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.TabPage: FormTabPageControl tabpageControl = control as FormTabPageControl; tabpageControl.Caption = this.labelManager.createLabel(tabpageControl.Caption); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.CommandButton: FormCommandButtonControl commandbuttonControl = control as FormCommandButtonControl; commandbuttonControl.Text = this.labelManager.createLabel(commandbuttonControl.Text); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.MenuButton: FormMenuButtonControl menubuttonControl = control as FormMenuButtonControl; menubuttonControl.Text = this.labelManager.createLabel(menubuttonControl.Text); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.MenuFunctionButton: FormMenuFunctionButtonControl menufunctionControl = control as FormMenuFunctionButtonControl; menufunctionControl.Text = this.labelManager.createLabel(menufunctionControl.Text); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ListBox: FormListBoxControl listboxControl = control as FormListBoxControl; listboxControl.Label = this.labelManager.createLabel(listboxControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Time: FormTimeControl timeControl = control as FormTimeControl; timeControl.Label = this.labelManager.createLabel(timeControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ButtonSeparator: FormButtonSeparatorControl buttonseparatorControl = control as FormButtonSeparatorControl; buttonseparatorControl.Text = this.labelManager.createLabel(buttonseparatorControl.Text); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Guid: FormGuidControl guidControl = control as FormGuidControl; guidControl.Label = this.labelManager.createLabel(guidControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.Int64: FormInt64Control int64Control = control as FormInt64Control; int64Control.Label = this.labelManager.createLabel(int64Control.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.DateTime: FormDateTimeControl datetimeControl = control as FormDateTimeControl; datetimeControl.Label = this.labelManager.createLabel(datetimeControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ActionPane: FormActionPaneControl actionpaneControl = control as FormActionPaneControl; actionpaneControl.Caption = this.labelManager.createLabel(actionpaneControl.Caption); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ActionPaneTab: FormActionPaneTabControl actionpanetabControl = control as FormActionPaneTabControl; actionpanetabControl.Caption = this.labelManager.createLabel(actionpanetabControl.Caption); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.SegmentedEntry: FormSegmentedEntryControl segmentedEntryControl = control as FormSegmentedEntryControl; segmentedEntryControl.Label = this.labelManager.createLabel(segmentedEntryControl.Label); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.DropDialogButton: FormDropDialogButtonControl dropDialogButtonControl = control as FormDropDialogButtonControl; dropDialogButtonControl.Text = this.labelManager.createLabel(dropDialogButtonControl.Text); break; case Microsoft.Dynamics.AX.Metadata.Core.MetaModel.FormControlType.ReferenceGroup: FormReferenceGroupControl referenceGroupControl = control as FormReferenceGroupControl; referenceGroupControl.Label = this.labelManager.createLabel(referenceGroupControl.Label); break; default: throw new NotImplementedException($"Form control type {control.Type.ToString()} is not implemented."); } control.HelpText = this.labelManager.createLabel(control.HelpText); } }