예제 #1
0
        public async Task SetupAsync()
        {
            using var session = await _systemContext.StartSystemSessionAsync();

            session.StartTransaction();

            var version =
                await _systemContext.GetConfigurationAsync(session, IdentityServiceConstants.IdentitySchemaVersionKey,
                                                           0);

            if (version < IdentityServiceConstants.IdentitySchemaVersionValue)
            {
                await CreateClients();
                await CreateUsersAndRoles();

                await CreateApiScopes();
                await CreateApiResources();
                await CreateIdentityResources();
                await CreateIdentityProvider();

                await _systemContext.SetConfigurationAsync(session, IdentityServiceConstants.IdentitySchemaVersionKey,
                                                           IdentityServiceConstants.IdentitySchemaVersionValue);
            }

            await session.CommitTransactionAsync();
        }
예제 #2
0
        public async Task SetupAsync()
        {
            using var session = await _systemContext.StartSystemSessionAsync();

            session.StartTransaction();

            var version =
                await _systemContext.GetConfigurationAsync(session, JobServiceConstants.JobServiceSchemaVersionKey, 0);

            if (version < JobServiceConstants.JobServiceSchemaVersionValue)
            {
                await CreateApiScopes();
                await CreateApiResources();
                await CreateClients();

                await _systemContext.SetConfigurationAsync(session, JobServiceConstants.JobServiceSchemaVersionKey,
                                                           JobServiceConstants.JobServiceSchemaVersionValue);
            }

            await session.CommitTransactionAsync();
        }