Skip to content

Commit

Permalink
local tenant init job actuator endpoint and legacy py script clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Dec 17, 2024
1 parent 8ef1797 commit 1f9969b
Show file tree
Hide file tree
Showing 15 changed files with 122 additions and 318 deletions.
5 changes: 5 additions & 0 deletions docs/tenant-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Tenant Setup

## Abstract

## How to
4 changes: 0 additions & 4 deletions local-environment/local-initializer/build.sh

This file was deleted.

19 changes: 0 additions & 19 deletions local-environment/local-initializer/init.sh

This file was deleted.

248 changes: 0 additions & 248 deletions local-environment/local-initializer/setup.py

This file was deleted.

4 changes: 4 additions & 0 deletions local-environment/request.http
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ GET {{actuatorHost}}/actuator
POST {{actuatorHost}}/actuator/database-clean-up


### acgtuator tenant setup job
POST {{actuatorHost}}/actuator/tenant-setup


### login page
GET {{host}}/login

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.vauthenticator.server.management

import com.vauthenticator.server.account.domain.AccountRepository
import com.vauthenticator.server.keys.domain.KeyRepository
import com.vauthenticator.server.keys.domain.KeyStorage
import com.vauthenticator.server.management.cleanup.DatabaseTtlEntryCleanJob
import com.vauthenticator.server.management.cleanup.DatabaseTtlEntryCleanJobEndPoint
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.jdbc.core.JdbcTemplate
import com.vauthenticator.server.management.init.*
import com.vauthenticator.server.oauth2.clientapp.domain.ClientApplicationRepository
import com.vauthenticator.server.password.domain.VAuthenticatorPasswordEncoder
import com.vauthenticator.server.role.domain.RoleRepository
import org.springframework.beans.factory.annotation.Value
import java.time.Clock

@Configuration(proxyBeanMethods = false)
class TenantInitConfig {

@Bean
fun accountSetUpJob(
roleRepository: RoleRepository,
accountRepository: AccountRepository,
passwordEncoder: VAuthenticatorPasswordEncoder
) = AccountSetUpJob(
roleRepository, accountRepository, passwordEncoder
)

@Bean
fun clientApplicationSetUpJob(
clientApplicationRepository: ClientApplicationRepository,
passwordEncoder: VAuthenticatorPasswordEncoder

) = ClientApplicationSetUpJob(clientApplicationRepository, passwordEncoder)

@Bean
fun keySetUpJob(
@Value("\${key.master-key}") maserKid: String,
keyStorage: KeyStorage,
keyRepository: KeyRepository
) = KeySetUpJob(
maserKid, keyStorage, keyRepository
)

@Bean
fun tenantSetUpEndPoint(
accountSetUpJob: AccountSetUpJob,
clientApplicationSetUpJob: ClientApplicationSetUpJob,
keySetUpJob: KeySetUpJob
) =
TenantSetUpEndPoint(
accountSetUpJob,
clientApplicationSetUpJob,
keySetUpJob
)

}

@Profile("database")
@Configuration(proxyBeanMethods = false)
class DatabaseTtlEntryCleanJobConfig {

@Bean
fun databaseTtlEntryCleanJob(
jdbcTemplate: JdbcTemplate
) = DatabaseTtlEntryCleanJob(jdbcTemplate, Clock.systemUTC())

@Bean
fun databaseTtlEntryCleanJobEndPoint(databaseTtlEntryCleanJob: DatabaseTtlEntryCleanJob) =
DatabaseTtlEntryCleanJobEndPoint(databaseTtlEntryCleanJob)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.vauthenticator.server.management
package com.vauthenticator.server.management.cleanup

import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Bean
Expand Down Expand Up @@ -53,17 +53,3 @@ class DatabaseTtlEntryCleanJob(

}


@Profile("database")
@Configuration(proxyBeanMethods = false)
class DatabaseTtlEntryCleanJobConfig() {

@Bean
fun databaseTtlEntryCleanJob(
jdbcTemplate: JdbcTemplate
) = DatabaseTtlEntryCleanJob(jdbcTemplate, Clock.systemUTC())

@Bean
fun databaseTtlEntryCleanJobEndPoint(databaseTtlEntryCleanJob: DatabaseTtlEntryCleanJob) =
DatabaseTtlEntryCleanJobEndPoint(databaseTtlEntryCleanJob)
}
Loading

0 comments on commit 1f9969b

Please sign in to comment.