public void SetUp() { _configurationWrapper = new ConfigurationWrapper(); _platformService = new PlatformServiceClient(); _ministryPlatformService = new MinistryPlatformServiceImpl(_platformService, _configurationWrapper); _fixture = new AuthenticationServiceImpl(_platformService, _ministryPlatformService); }
public MinistryPlatformServiceImpl(PlatformServiceClient platformServiceClient, IConfigurationWrapper configurationWrapper) { _platformServiceClient = platformServiceClient; _configurationWrapper = configurationWrapper; _impersonateCookieName = string.Format("{0}.1", FormsAuthentication.FormsCookieName); }
public static void VoidCall(String token, Action <PlatformServiceClient> ministryPlatformFunc) { var platformServiceClient = new PlatformServiceClient(); using (new OperationContextScope((IClientChannel)platformServiceClient.InnerChannel)) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingRequest.Headers.Add("Authorization", "Bearer " + token); } ministryPlatformFunc(platformServiceClient); } }
/// <summary> /// 发送命令 /// </summary> /// <param name="cmd"></param> /// <param name="client"></param> public void SendToService(CtrlPlatformCommandInfo cmd, IPlatformClient client) { try { PlatformServiceClient psc = new PlatformServiceClient(); psc.DoActionCompleted += client_DoActionCompleted; psc.DoActionAsync(CommandHelper.ToPlatfromCommandInfo(cmd), client); } catch (Exception ee) { PrintfLog(ee); } // PrintfLog(cmd, "发送命令信息"); }
public static T Call <T>(String token, Func <PlatformServiceClient, T> ministryPlatformFunc) { T result; var platformServiceClient = new PlatformServiceClient(); using (new OperationContextScope((IClientChannel)platformServiceClient.InnerChannel)) { if (WebOperationContext.Current != null) { WebOperationContext.Current.OutgoingRequest.Headers.Add("Authorization", "Bearer " + token); } result = ministryPlatformFunc(platformServiceClient); } return(result); }
public AuthenticationServiceImpl(PlatformServiceClient platformService, IMinistryPlatformService ministryPlatformService) { this.platformService = platformService; this.ministryPlatformService = ministryPlatformService; }