/// <summary> /// 字段及依赖注入构造器 /// </summary> /// <param name="userPresenter">用户呈现器接口</param> /// <param name="authenticationContract">身份认证服务接口</param> /// <param name="userContract">用户服务接口</param> /// <param name="systemPresenter">信息系统呈现器接口</param> public UserController(IUserPresenter userPresenter, IAuthenticationContract authenticationContract, IUserContract userContract, IInfoSystemPresenter systemPresenter) { this._userPresenter = userPresenter; this._authenticationContract = authenticationContract; this._userContract = userContract; this._systemPresenter = systemPresenter; }
/// <summary> /// 此测试用例的目的在于测试消息头的发送是否成功 /// </summary> static void Main() { //初始化容器 InitContainer(); //伪造一个登录信息 IAuthenticationContract authenticationContract = ResolveMediator.Resolve <IAuthenticationContract>(); LoginInfo fakeLoginInfo = authenticationContract.Login(CommonConstants.AdminLoginId, CommonConstants.InitialPassword); //将登录信息存入约定位置 AppDomain.CurrentDomain.SetData(SessionKey.CurrentUser, fakeLoginInfo); //实例化WCF客户端服务接口 IClientContract clientContract = ResolveMediator.Resolve <IClientContract>(); //调用服务获取消息头, string header = clientContract.GetHeader(); //如果消息头内容即是上述伪造的公钥,即说明整个认证过程没问题 if (fakeLoginInfo.PublicKey.ToString() == header) { Console.WriteLine("认证通过!"); } ResolveMediator.Dispose(); Console.ReadKey(); }
/// <summary> /// 此测试用例的目的在于测试消息头的发送是否成功 /// </summary> protected void Page_Load(object sender, EventArgs e) { //初始化容器 InitContainer(); //伪造一个登录信息 IAuthenticationContract authenticationContract = ResolveMediator.Resolve <IAuthenticationContract>(); LoginInfo fakeLoginInfo = authenticationContract.Login(CommonConstants.AdminLoginId, CommonConstants.InitialPassword); //将登录信息存入约定位置 base.Session.Add(SessionKey.CurrentUser, fakeLoginInfo); //实例化WCF服务端服务接口 IServerContract serverContract = ResolveMediator.Resolve <IServerContract>(); //调用服务获取消息头 string header = serverContract.GetHeader(); //如果消息头内容即是上述伪造的公钥,即说明整个认证过程没问题 if (fakeLoginInfo.PublicKey.ToString() == header) { base.Response.Write("认证通过!"); } ResolveMediator.Dispose(); }
public void Init() { //初始化配置文件 Assembly entryAssembly = Assembly.GetExecutingAssembly(); Configuration configuration = ConfigurationExtension.GetConfigurationFromAssembly(entryAssembly); ServiceModelSectionGroup.Initialize(configuration); ServiceProxy <IAuthenticationContract> authenticationContractProxy = new ServiceProxy <IAuthenticationContract>(); ServiceProxy <IUserContract> userContractProxy = new ServiceProxy <IUserContract>(); this._authenticationContract = authenticationContractProxy.Channel; this._userContract = userContractProxy.Channel; }
/// <summary> /// 依赖注入构造器 /// </summary> public MainWindow(IAuthorizationContract authorizationContract, IAuthenticationContract authenticationContract) { this._authorizationContract = authorizationContract; this._authenticationContract = authenticationContract; this.InitializeComponent(); //用户名/密码 string loginId = CommonConstants.AdminLoginId; string password = CommonConstants.InitialPassword; //登录 LoginInfo loginInfo = this._authenticationContract.Login(loginId, password); AppDomain.CurrentDomain.SetData(GlobalSetting.ApplicationId, loginInfo); }
public void CreateProduct(string productNo, string productName, IEnumerable <PriceParam> priceParams) { Trace.WriteLine(productNo); Trace.WriteLine(productName); Trace.WriteLine(priceParams); //伪造一个登录信息 IAuthenticationContract authenticationContract = ResolveMediator.Resolve <IAuthenticationContract>(); LoginInfo fakeLoginInfo = authenticationContract.Login(CommonConstants.AdminLoginId, CommonConstants.InitialPassword); //实例化服务接口 IServerContract serverContract = ResolveMediator.Resolve <IServerContract>(); //调用服务获取消息头 string header = serverContract.GetHeader(); //如果消息头内容即是上述伪造的公钥,即说明整个认证过程没问题 if (fakeLoginInfo.PublicKey.ToString() == header) { Console.WriteLine("认证通过!"); } }
public string GetProducts(string keywords, int pageIndex, int pageSize) { Trace.WriteLine(keywords); Trace.WriteLine(pageIndex); Trace.WriteLine(pageSize); //伪造一个登录信息 IAuthenticationContract authenticationContract = ResolveMediator.Resolve <IAuthenticationContract>(); LoginInfo fakeLoginInfo = authenticationContract.Login(CommonConstants.AdminLoginId, CommonConstants.InitialPassword); //实例化服务接口 IServerContract serverContract = ResolveMediator.Resolve <IServerContract>(); //调用服务获取消息头 string header = serverContract.GetHeader(); //如果消息头内容即是上述伪造的公钥,即说明整个认证过程没问题 if (fakeLoginInfo.PublicKey.ToString() == header) { Console.WriteLine("认证通过!"); } return("Hello World"); }
/// <summary> /// 依赖注入构造器 /// </summary> public AuthenticationController(IAuthenticationContract authenticationContract) { this._authenticationContract = authenticationContract; }
public AccountController(IAuthenticationContract authentication) => this.authentication = authentication;
public IEnumerable <Order> GetOrders(string keywords, int pageIndex, int pageSize) { Trace.WriteLine(keywords); Trace.WriteLine(pageIndex); Trace.WriteLine(pageSize); //伪造一个登录信息 IAuthenticationContract authenticationContract = ResolveMediator.Resolve <IAuthenticationContract>(); LoginInfo fakeLoginInfo = authenticationContract.Login(CommonConstants.AdminLoginId, CommonConstants.InitialPassword); //实例化服务接口 IServerContract serverContract = ResolveMediator.Resolve <IServerContract>(); //调用服务获取消息头 string header = serverContract.GetHeader(); //如果消息头内容即是上述伪造的公钥,即说明整个认证过程没问题 if (fakeLoginInfo.PublicKey.ToString() == header) { Console.WriteLine("认证通过!"); } IList <Order> orders = new List <Order> { new Order { Number = "001", Name = "单据1", Details = new List <OrderDetail> { new OrderDetail { Number = "明细1", Description = "明细1" }, new OrderDetail { Number = "明细2", Description = "明细2" } } }, new Order { Number = "002", Name = "单据2", Details = new List <OrderDetail> { new OrderDetail { Number = "明细1", Description = "明细1" }, new OrderDetail { Number = "明细2", Description = "明细2" }, } } }; return(orders); }
private IHttpContextAccessor _accessor; //جهت به دست آوردن ip کلاینت /// <summary> /// constructor /// </summary> /// <param name="sysDataAccessLayer">instance of ISysDataAccessLayer</param> /// <param name="tokenService">instance of ISPPCTokenService</param> /// <param name="accessor">instance of IHttpContextAccessor</param> public AuthenticationController(IAuthenticationContract authenticationContract, ITokenServiceContract tokenService, IHttpContextAccessor accessor) { AuthenticationContract = authenticationContract; _tokenService = tokenService; _accessor = accessor; }
public UsersController(IUserContract userRepository, IAuthenticationContract authenticationContract) { UserContract = userRepository; AuthenticationContract = authenticationContract; }