public ReturnBody <AuthorizationUserModel> GetAuthorizationuser(AuthorizationUserModel model) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <AuthorizationUserModel>(namespaceName, "GetAuthorizationuser", model); try { #region 验证 if (model == null || string.IsNullOrEmpty(model.s95id)) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg)); } #endregion var retModel = Authorizationbll.GetAuthorization(model.s95id); if (retModel == null) { exception.exceptionMsg = "没有找到相关用户"; return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.FAILURE, exception.exceptionMsg)); } return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
public async Task <IHttpActionResult> AuthorizeEmployee(AuthorizationUserModel model) { var loginBytes = Convert.FromBase64String(model.Login); var login = System.Text.Encoding.ASCII.GetString(loginBytes); var passwordBytes = Convert.FromBase64String(model.Password); var password = System.Text.Encoding.ASCII.GetString(passwordBytes); var user = await _singleSignOnManager.Authorization(login, password); if (user == null) { return(NotFound()); } return(await GenerateTokenResponse(user, TimeSpan.FromHours(TicketLifetimeHours))); }
/// <summary> /// 根据用户名称获取用户的描述 /// </summary> /// <param name="s95id"></param> /// <returns></returns> public AuthorizationUserModel GetAuthorization(string s95id) { SqlParameter[] parameters = { new SqlParameter("@s95id", SqlDbType.NVarChar, 500) }; parameters[0].Value = s95id; DataSet ds = SQLServerHelper.RunProcedure("UspWip_GetAuthorization", parameters, "pagetable"); AuthorizationUserModel model = new AuthorizationUserModel(); if (ds.Tables[0].Rows.Count > 0) { var dataRow = ds.Tables[0].Rows[0]; model.s95id = dataRow["s95id"].ToString(); model.Description = dataRow["Description"].ToString(); return(model); } else { return(null); } }