示例#1
0
        public IActionResult AuthCodeV1_Ask([FromQuery] AuthCodeAskV1 input)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            return(StatusCode((int)HttpStatusCode.NotImplemented));
        }
示例#2
0
        /*
         * https://oauth.net/2/grant-types/authorization-code/
         */
        public async ValueTask <HttpResponseMessage> AuthCode_AskV1(AuthCodeAskV1 model)
        {
            string content = "?issuer_id=" + HttpUtility.UrlEncode(model.issuer_id)
                             + "&client_id=" + HttpUtility.UrlEncode(model.client_id)
                             + "&username="******"&redirect_uri=" + HttpUtility.UrlEncode(model.redirect_uri)
                             + "&response_type=" + model.response_type
                             + "&scope=" + HttpUtility.UrlEncode(model.scope);

            return(await _http.GetAsync("oauth2/v1/acg-ask" + content));
        }
示例#3
0
        public async ValueTask <AuthCodeV1> AuthCode_AskV1(AuthCodeAskV1 model)
        {
            var response = await Endpoints.AuthCode_AskV1(model);

            if (response.IsSuccessStatusCode)
            {
                return(await response.Content.ReadAsAsync <AuthCodeV1>().ConfigureAwait(false));
            }

            throw new HttpRequestException(response.RequestMessage.ToString(),
                                           new Exception(response.ToString()));
        }