public static IGateKeeper CreateGatekeeper(object owner, String name) { var keeper = new GateKeeper(owner, name); _sGateKeepers.Add(keeper); return(keeper); }
public static async Task <IActionResult> SendMessageToUser( [HttpTrigger(AuthorizationLevel.Anonymous, Global.HttpVerbPost, Route = nameof(SendMessageToUser) + Global.UserIdQueryParam)] HttpRequest req, [SignalR(HubName = Global.SignalRHubName)] IAsyncCollector <SignalRMessage> signalRMessages, ILogger log, String userId ) { var validateTokenResult = GateKeeper.ValidateToken(req.Headers); if (validateTokenResult.Unauthorized) { log.LogError(validateTokenResult.Exception, validateTokenResult.LogMessage()); return(new UnauthorizedResult()); } using (var sr = new StreamReader(req.Body)) { var message = sr.ReadToEnd(); log.LogInformation(String.Format(GlobalMessages.SendingMessageOnlyToUserFormat, message, userId)); await signalRMessages.AddAsync( new SignalRMessage { UserId = userId, Target = Global.MessageTarget, Arguments = new[] { message } }); return(new OkResult()); } }
public PSLGatekeeper1() { //CODEGEN: This call is required by the ASP.NET Web Services Designer InitializeComponent(); m_gk = new GateKeeper(); m_gk.Name = "PSLGatekeeper1"; m_gk.TraceOn = true; }
public void WhenSetLoggedInUser() { var user = new User("User"); var gateKeeper = new GateKeeper(); gateKeeper.SetLoggedIn(user); Assert.IsTrue(gateKeeper.IsLoggedIn); Assert.AreEqual(user, gateKeeper.LoggedInUser); }
public void SetLoggedInUser() { var user = new User("User"); var gateKeeper = new GateKeeper(); gateKeeper.SetLoggedIn(user); Assert.AreSame(user, gateKeeper.LoggedInUser); }
public void Setup() { GateKeeper = new GateKeeper<bool>(v => v); MockGates = new List<MockGate> { new MockGate { CanClose = false }, new MockGate(), new MockGate { CanOpen = false }, }; }
public static IActionResult SignalRConnectionNotAsSecure( [HttpTrigger(AuthorizationLevel.Anonymous, Global.HttpVerbGet, Route = null)] HttpRequest req, [SignalRConnectionInfo(HubName = Global.SignalRHubName, UserId = "{headers.x-ms-client-principal-id}")] SignalRConnectionInfo connectionInfo, ILogger log) { var validateTokenResult = GateKeeper.ValidateToken(req.Headers); if (validateTokenResult.Unauthorized) { log.LogError(validateTokenResult.Exception, validateTokenResult.LogMessage()); return(new UnauthorizedResult()); } return(new OkObjectResult(connectionInfo)); }
public void Setup() { GateKeeper = new GateKeeper <bool>(v => v); MockGates = new List <MockGate> { new MockGate { CanClose = false }, new MockGate(), new MockGate { CanOpen = false }, }; }
public void Initialize() { gateKeeper = new GameObject("gatekeeper").AddComponent <GateKeeper>(); // immortal gatekeeper GameObject.DontDestroyOnLoad(gateKeeper.gameObject); gateKeeper.RunRoutine(GateKeeperRoutine()); var remoteConfig = Utilities.LoadRemoteConfig(); if (remoteConfig == null) { return; } remoteKeeper = new GameObject("remoteKeeper").AddComponent <GateKeeperRemote>(); GameObject.DontDestroyOnLoad(remoteKeeper); Utilities.StartKeymasterRemote(remoteConfig.port); }
public static IActionResult SignalRConnection( [HttpTrigger(AuthorizationLevel.Anonymous, Global.HttpVerbGet, Route = null)] HttpRequest req, IBinder binder, ILogger log) { var validateTokenResult = GateKeeper.ValidateToken(req.Headers); if (validateTokenResult.Unauthorized) { log.LogError(validateTokenResult.Exception, validateTokenResult.LogMessage()); return(new UnauthorizedResult()); } var connectionInfo = binder.Bind <SignalRConnectionInfo>(new SignalRConnectionInfoAttribute { HubName = Global.SignalRHubName, UserId = validateTokenResult.TokenModel.UserId }); return(new OkObjectResult(connectionInfo)); }
public void TestGateKeeper_TryPassThrough_Success() { GateKeeper = new GateKeeper <bool>(v => v); MockGates = new List <MockGate> { new MockGate(), new MockGate(), new MockGate(), }; bool value; Assert.IsTrue(GateKeeper.TryPassThrough(MockGates, out value)); Assert.IsTrue(value); foreach (MockGate gate in MockGates) { Assert.IsTrue(gate.OpenCalled); Assert.IsTrue(gate.CloseCalled); } }
public static void GenerateAllProxies() { GateKeeper g = new GateKeeper(); // Generate Proxies for all the web services we want to interact with // TODO: WeatherConditions g.GenerateProxy("WeatherRetriever", "http://www.vbws.com/services/weatherretriever.asmx?WSDL", "http://www.vbws.com/services/weatherretriever.asmx"); // Google Search g.GenerateProxy("GoogleSearchService", "http://api.google.com/GoogleSearch.wsdl", "http://api.google.com/search/beta2"); // GeoCash g.GenerateProxy("GeoCash", "http://ws.serviceobjects.net/gc/GeoCash.asmx?WSDL", "http://ws.serviceobjects.net/gc/GeoCash.asmx"); // BNQuoteService g.GenerateProxy("BNQuoteService", "http://www.xmethods.net/sd/2001/BNQuoteService.wsdl", "http://services.xmethods.net:80/soap/servlet/rpcrouter"); // WorldCup Scores g.GenerateProxy("CupScores", "http://64.78.60.122/CupScores.asmx?WSDL", "http://64.78.60.122/CupScores.asmx"); // Randon Neil Finn Lyric Server g.GenerateProxy("finnwordsService", "http://www.nickhodge.com/nhodge/finnwords/finnwords.wsdl", "http://www.nickhodge.com/nhodge/finnwords/finnwordssoapengine.php"); // Joke Server g.GenerateProxy("JokeServer", "http://www.xml-webservices.net/services/entretainment/joke_server.asmx?WSDL", "http://www.xml-webservices.net/services/entretainment/joke_server.asmx"); // XMethods Query g.GenerateProxy("XMethodsQuery", "http://www.xmethods.net/wsdl/query.wsdl", "http://www.xmethods.net/interfaces/query"); // SecurityManager Service g.GenerateProxy("SecurityManagerService", "http://church.psl.cs.columbia.edu:8080/security/SecurityServices.wsdl", "http://church.psl.cs.columbia.edu:8080/security/jaxrpc/SecurityManagerService"); }
public void TestGateKeeper_TryPassThrough_Success() { GateKeeper = new GateKeeper<bool>(v => v); MockGates = new List<MockGate> { new MockGate(), new MockGate(), new MockGate(), }; bool value; Assert.IsTrue(GateKeeper.TryPassThrough(MockGates, out value)); Assert.IsTrue(value); foreach (MockGate gate in MockGates) { Assert.IsTrue(gate.OpenCalled); Assert.IsTrue(gate.CloseCalled); } }
public static void TestServiceMethods() { // GateKeeper instance GateKeeper g = new GateKeeper(); g.TraceOn = false; object objRes = null; //InternalRegistry ireg = new InternalRegistry(); //ireg.UpdateServiceLocation( "SecurityManagerService", "http://church.psl.cs.columbia.edu:8080/security/SecurityServices.wsdl" ); // SetupServiceSpace(); ExecServiceMethodRequestType e = new ExecServiceMethodRequestType(); // TODO: WeatherConditions testing webservice e.TreatyID = -1820085390; //-115276743; e.ServiceName = "WeatherRetriever"; e.MethodName = "GetTemperature"; e.MethodName = "GetWeather"; e.m_ParamValue.Clear(); e.m_ParamValue.Add("<?xml version=\"1.0\"?><string>10027</string>"); objRes = g.ExecuteServiceMethod(e.ToXml()); // TODO: Traffic Conditions in Chicago testing webservice /* e.TreatyID = -1820085390;//-115276743; * e.ServiceName = "CATrafficService"; * e.MethodName = "getTraffic"; * e.m_ParamValue.Clear(); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>209</string>" ); * * objRes = g.ExecuteServiceMethod( e.ToXml() ); * Console.Write(objRes.ToString()); * * // TODO: Query for 2 different Highways * e.m_ParamValue.Clear(); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>5</string>" ); * * objRes = g.ExecuteServiceMethod( e.ToXml() ); * Console.Write(objRes.ToString()); * * * e.TreatyID = -1820085390;//-115276743; * e.ServiceName = "GeoPinPoint"; * e.MethodName = "GetLocation"; * e.m_ParamValue.Clear(); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>128.59.23.57</string>" ); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>0</string>" ); // license key * * * e.TreatyID = -1820085390;//-115276743; * e.ServiceName = "ZipCodeResolver"; * e.MethodName = "FullZipCode"; * e.m_ParamValue.Clear(); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>0</string>" ); // license key * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>500 West 120th Street</string>" ); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>New York</string>" ); * e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>NY</string>" ); * * objRes = g.ExecuteServiceMethod( e.ToXml() ); * Console.Write(objRes.ToString()); * * //objRes = g.EnlistServicesByName( "<?xml version=\"1.0\"?><Treaty xmlns=\"http://localhost/Discus/Schema/Treaty.xsd\"><TreatyID>1000</TreatyID><ClientServiceSpace>myservicespace</ClientServiceSpace><ProviderServiceSpace>providerss</ProviderServiceSpace><ServiceInfo><ServiceName>service</ServiceName><ServiceMethod><MethodName>method</MethodName><Parameter>foo</Parameter><Parameter>bar</Parameter><NumInvokations>1</NumInvokations><Authorized>true</Authorized></ServiceMethod></ServiceInfo></Treaty>" ); * * // Sql script for service invocation permission table * // insert into serviceinvokationpermission values(100,'BNQuoteService','getPrice','isbn',100000,'getPrice'); * // insert into serviceinvokationpermission values(100,'XMethodsQuery','getAllServiceSummaries','',100000,'getAllServiceSummaries'); * // insert into serviceinvokationpermission values(100,'XMethodsQuery','getServiceNamesByPublisher','PubName',100000,'getServiceNamesByPublisher'); * // insert into serviceinvokationpermission values(100,'GeoCash','GetATMLocations','Zipcode',100000,'GetATMLocations'); * // GeoCash * //e.ServiceName = "GeoCash"; * //e.MethodName = "GetATMLocations"; * //e.m_ParamValue.Clear(); * //e.m_ParamValue.Add( "<?xml version=\"1.0\"?><string>10025</string>" ); * //objRes = g.ExecuteServiceMethod( e.ToXml() ); * * // Google*/ }
public Sampler(GateKeeper keeper) { _keeper = keeper; }
void OnTriggerEnter(Collider other) { GateKeeper.setPassedGateCount(this); }
public void WhenCreatedLoggedInUserIsNull() { var gateKeeper = new GateKeeper(); Assert.Null(gateKeeper.LoggedInUser); }
public void SetBossBehaviour(GateKeeper bossBehaviour) { this.bossBehaviour = bossBehaviour; }