public async Task <IAuthorisationServer> GetAuthorisationServer(string id,
                                                                        CancellationToken cancellationToken = default(CancellationToken))
        {
            var requestUrl = _client.Configuration.BuildUrl($"/api/v1/authorizationServers/{id}");

            return(await _client.GetAsync <AuthorisationServer>(requestUrl.AbsoluteUri, cancellationToken));
        }
コード例 #2
0
        /// <inheritdoc />
        public async Task <IOrganisation> GetOrganisation(
            string orgName,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var requestUrl = _client.Configuration.BuildUrl($"/api/v1/orgs/{orgName}");

            return(await _client.GetAsync <Organisation>(requestUrl.AbsoluteUri, cancellationToken));
        }
        /// <inheritdoc />
        public async Task <ILocaleSettings> GetLocaleSettings(
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var requestUrl = _client.Configuration.BuildUrl($"/api/internal/org/settings/locale");

            return(await _client.GetAsync <LocaleSettings>(requestUrl.AbsoluteUri, cancellationToken));
        }
コード例 #4
0
        /// <summary>
        /// Ensure that the application in the destination okta tenant exists and exactly matches the provided one
        /// </summary>
        /// <param name="client"></param>
        /// <param name="targetState"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public static async Task EnsureApplication(this IOktaClient client, Application targetState, CancellationToken cancellationToken)
        {
            //Attempt to get the existing application by looking it up based on label
            var currentState = await GetIfExists(() =>
                                                 client.GetAsync <Application>($"/api/v1/apps?q={Uri.EscapeDataString(targetState.Label)}",
                                                                               cancellationToken));

            if (currentState.CurrentState != EntityState <Application> .State.DoesNotExist)
            {
                //If it exists already, but doesn't match, then we need to override it
                await client.Applications.UpdateApplicationAsync(targetState, currentState.Entity.Id, cancellationToken);
            }
            else
            {
                await client.Applications.CreateApplicationAsync(targetState,
                                                                 activate : true,
                                                                 cancellationToken : cancellationToken);
            }
        }
コード例 #5
0
        public static IEnumerable <SchemaAttribute> GetSchemaJson(IOktaClient client)
        {
            Resource result = AsyncHelper.RunSync(client.GetAsync <Resource>(
                                                      new HttpRequest
            {
                Uri = "/api/v1/meta/schemas/user/default",
            }));


            IDictionary <string, object> definitions = result["definitions"] as IDictionary <string, object>;

            foreach (SchemaAttribute schemaAttribute in SchemaProvider.GetAttributesFromDefinition(definitions, "base"))
            {
                yield return(schemaAttribute);
            }

            foreach (SchemaAttribute schemaAttribute in SchemaProvider.GetAttributesFromDefinition(definitions, "custom"))
            {
                yield return(schemaAttribute);
            }
        }
コード例 #6
0
        public async Task <ISchema> GetUserSchema(CancellationToken cancellationToken = default(CancellationToken))
        {
            var requestUrl = _client.Configuration.BuildUrl($"/api/v1/meta/schemas/user/default");

            return(await _client.GetAsync <Schema>(requestUrl.AbsoluteUri, cancellationToken));
        }