コード例 #1
0
        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."));
            }
        }
コード例 #2
0
        public void Contains()
        {
            LaunchCode      launchCode      = new LaunchCode();
            UsedLaunchCodes usedLaunchCodes = new FakeUsedLaunchCodes();

            usedLaunchCodes.Contains(launchCode).Should().BeFalse();
            usedLaunchCodes.Add(launchCode);
            usedLaunchCodes.Contains(launchCode).Should().BeTrue();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 public void Launch(Missile missile, LaunchCode code, UsedLaunchCodes usedCodes)
 {
     if (code.isValidCode() && !usedCodes.Contains(code))
     {
         missile.Launch();
         usedCodes.Add(code);
     }
     else
     {
         missile.Disable();
     }
 }
コード例 #5
0
 public virtual void Add(LaunchCode launchCode)
 {
     throw new System.NotImplementedException();
 }
コード例 #6
0
 public virtual bool Contains(LaunchCode launchCode)
 {
     throw new System.NotImplementedException();
 }
コード例 #7
0
 public override bool Contains(LaunchCode launchCode)
 {
     return(set.Contains(launchCode));
 }
コード例 #8
0
 public override void Add(LaunchCode launchCode)
 {
     set.Add(launchCode);
 }