public async Task <IActionResult> GetAuth([FromQuery] string launchCode) { if (launchCode == null) { string hdkLaunchUrl = $"https://dev-unified-api.ucsf.edu/clinical/hdk/2.0/oauth2/launchcode"; LaunchCode launchResponse = await this.GetLaunchCode <LaunchCode>(hdkLaunchUrl); if (launchResponse == null) { return(Unauthorized("Error while retrieving Launch Code.")); } launchCode = launchResponse.launchcode; } string hdkAuthorizeUrl = $"https://dev-unified-api.ucsf.edu/clinical/hdk/2.0/oauth2/authorize?response_type=code&client_id=820a491727ea4bc3a205e525acfe8764&redirect_uri=https://dev-unified-api.ucsf.edu/clinical/hdk/2.0/oauth2/app/redirect&scope=launch+patient%2FObservation.read+patient%2FPatient.read+openid+profile&state=:PatientAppstate&aud=https%3A%2F%2Fdev-unified-api.ucsf.edu%2Fclinical%2Fhdk%2F2.0&launch={launchCode}&code_challenge=YWE4MjU3MDJkNDNlODIzY2RmMGU2YTBjYWM3Yjc1NmI2MDA1NTVlZDUzOWY3Zjg3NWY0NTQyZGJmNTJkN2IzMA==&code_challenge_method=s256"; AuthResponse response = await this.GetAuthCode <AuthResponse>(hdkAuthorizeUrl); if (response != null) { return(Ok(response)); } else { return(Unauthorized("Error while retrieving Auth Code.")); } }
public void Contains() { LaunchCode launchCode = new LaunchCode(); UsedLaunchCodes usedLaunchCodes = new FakeUsedLaunchCodes(); usedLaunchCodes.Contains(launchCode).Should().BeFalse(); usedLaunchCodes.Add(launchCode); usedLaunchCodes.Contains(launchCode).Should().BeTrue(); }
public void GivenUsedCodes_MissileCodeRedAbort() { var code = new LaunchCode(); var missileOne = new Missile(); _missileLauncher.Launch(missileOne, code, _usedCodes); var missileTwo = new MockMissile(); _missileLauncher.Launch(missileTwo, code, _usedCodes); missileTwo.VerifyCodeRedAbort(); }
public void Launch(Missile missile, LaunchCode code, UsedLaunchCodes usedCodes) { if (code.isValidCode() && !usedCodes.Contains(code)) { missile.Launch(); usedCodes.Add(code); } else { missile.Disable(); } }
public virtual void Add(LaunchCode launchCode) { throw new System.NotImplementedException(); }
public virtual bool Contains(LaunchCode launchCode) { throw new System.NotImplementedException(); }
public override bool Contains(LaunchCode launchCode) { return(set.Contains(launchCode)); }
public override void Add(LaunchCode launchCode) { set.Add(launchCode); }