public IActionResult ClientCredentialV1_Grant([FromForm] ClientCredentialV1 input)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            return(StatusCode((int)HttpStatusCode.NotImplemented));
        }
Exemple #2
0
        public async ValueTask <ClientJwtV1> ClientCredential_GrantV1(ClientCredentialV1 model)
        {
            var response = await Endpoints.ClientCredential_AuthV1(model);

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

            throw new HttpRequestException(response.RequestMessage.ToString(),
                                           new Exception(response.ToString()));
        }
Exemple #3
0
        /*
         * https://oauth.net/2/grant-types/client-credentials/
         * https://oauth.net/2/grant-types/refresh-token/
         */
        public async ValueTask <HttpResponseMessage> ClientCredential_AuthV1(ClientCredentialV1 model)
        {
            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("issuer_id", model.issuer_id),
                new KeyValuePair <string, string>("client_id", model.client_id),
                new KeyValuePair <string, string>("grant_type", model.grant_type),
                new KeyValuePair <string, string>("client_secret", model.client_secret),
            });

            return(await _http.PostAsync("oauth2/v1/ccg", content));
        }