예제 #1
0
        public IActionResult Index(string authCode, string idToken, string accesstoken, string expiresin, string refreshtoken)
        {
            var vm = new HybridViewModel {
                IdToken = idToken, AuthCode = authCode, AccessToken = accesstoken, RefreshToken = refreshtoken, ExpiresIn = expiresin
            };

            return(View("Index", vm));
        }
예제 #2
0
 private object CreateViewModelForUriRedirect(HybridViewModel vm)
 {
     return(new
     {
         authCode = vm.AuthCode,
         idToken = vm.IdToken,
         accesstoken = vm.AccessToken,
         expiresin = vm.ExpiresIn,
         refreshtoken = vm.RefreshToken
     });
 }
예제 #3
0
        //public IActionResult GetAuthCode()
        //{

        //}

        //[HttpPost("hybrid/signin-oidc")]
        //public IActionResult AuthCodeReceived_Post()
        //{

        //}

        //[HttpGet]
        //public async Task<IActionResult> GetAccessToken(string authCode, string idToken )
        //{

        //}

        //[HttpGet]
        //public async Task<IActionResult> GetRefreshToken(string refreshToken, string idToken)
        //{

        //}


        private HybridViewModel ParseToAuthCodeViewModel(string content, string idToken)
        {
            var obj = JsonConvert.DeserializeObject(content) as JObject;

            if (obj == null)
            {
                return(null);
            }
            var vm = new HybridViewModel
            {
                AccessToken  = obj["access_token"].Value <string>(),
                ExpiresIn    = obj["expires_in"].Value <string>(),
                RefreshToken = obj["refresh_token"].Value <string>(),
                IdToken      = obj["id_token"]?.Value <string>()
            };

            if (vm.IdToken == null)
            {
                vm.IdToken = idToken;
            }
            return(vm);
        }