public async Task <IIdxResponse> IntrospectAsync(string interactionHandle = null, CancellationToken cancellationToken = default(CancellationToken)) { if (string.IsNullOrEmpty(interactionHandle)) { var interactResponse = await InteractAsync(cancellationToken); interactionHandle = interactResponse.InteractionHandle; } var payload = new IdxRequestPayload(); payload.SetProperty("interactionHandle", interactionHandle); var oktaDomain = UrlHelper.GetOktaRootUrl(this.Configuration.Issuer); var uri = $"{UrlHelper.EnsureTrailingSlash(oktaDomain)}idp/idx/introspect"; var headers = new Dictionary <string, string>(); headers.Add("Accept", "application/ion+json; okta-version=1.0.0"); var request = new HttpRequest { Uri = uri, Payload = payload, Headers = headers, }; return(await PostAsync <IdxResponse>( request, cancellationToken).ConfigureAwait(false)); }
/// <inheritdoc/> public async Task <IIdxResponse> CancelAsync(CancellationToken cancellationToken = default) { var cancelResponse = this.GetResourceProperty <CancelResponse>("cancel"); var stateHandleFormValue = cancelResponse.GetArrayProperty <FormValue>("value").FirstOrDefault(x => x.Name == "stateHandle"); var payload = new IdxRequestPayload() { StateHandle = stateHandleFormValue.GetProperty <string>("value"), }; // TODO: Get accept from Produces. var headers = new Dictionary <string, string>(); headers.Add("Accept", "application/ion+json; okta-version=1.0.0"); var request = new HttpRequest { Uri = cancelResponse.Href, Payload = payload, Headers = headers, }; var httpVerb = (HttpVerb)Enum.Parse(typeof(HttpVerb), cancelResponse.Method, true); return(await _client.SendAsync <IdxResponse>(request, httpVerb, cancellationToken).ConfigureAwait(false)); }
public async Task <IIdxResponse> ProceedAsync(IdxRequestPayload dataFromUi, CancellationToken cancellationToken = default) { // TODO: Get accept from Produces. var headers = new Dictionary <string, string>(); headers.Add("Accept", "application/ion+json; okta-version=1.0.0"); var request = new HttpRequest { Uri = Href, Payload = dataFromUi, Headers = headers, }; var httpVerb = (HttpVerb)Enum.Parse(typeof(HttpVerb), Method, true); return(await _client.SendAsync <IdxResponse>(request, httpVerb, cancellationToken).ConfigureAwait(false)); }
internal static async Task <IIdxResponse> ProceedWithRemediationOptionAsync(this IIdxResponse response, string remediationType, IdxRequestPayload request, CancellationToken cancellationToken = default) { var remediationOption = response.FindRemediationOption(remediationType, true); return(await remediationOption .ProceedAsync(request, cancellationToken)); }