Skip to content

Commit

Permalink
boyscout: configuration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Oct 30, 2024
1 parent 6f5d8ea commit 6b66f3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.vauthenticator.server.oauth2.clientapp

import com.fasterxml.jackson.databind.ObjectMapper
import com.vauthenticator.server.account.adapter.jdbc.JdbcAccountRepository
import com.vauthenticator.server.account.domain.AccountRepository
import com.vauthenticator.server.cache.CacheOperation
import com.vauthenticator.server.cache.RedisCacheOperation
import com.vauthenticator.server.oauth2.clientapp.adapter.cache.CachedClientApplicationRepository
import com.vauthenticator.server.oauth2.clientapp.adapter.cache.ClientApplicationCacheContentConverter
import com.vauthenticator.server.oauth2.clientapp.adapter.dynamodb.DynamoDbClientApplicationRepository
import com.vauthenticator.server.oauth2.clientapp.adapter.jdbc.JdbcClientApplicationRepository
import com.vauthenticator.server.oauth2.clientapp.domain.ClientApplicationRepository
import com.vauthenticator.server.oauth2.clientapp.domain.ReadClientApplication
import com.vauthenticator.server.oauth2.clientapp.domain.StoreClientApplication
Expand All @@ -14,7 +17,9 @@ import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.data.redis.core.RedisTemplate
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.security.crypto.password.PasswordEncoder
import software.amazon.awssdk.services.dynamodb.DynamoDbClient
import java.time.Duration
Expand All @@ -23,16 +28,20 @@ import java.time.Duration
class ClientApplicationConfig {


@Bean("clientApplicationRepository")
@Profile("experimental_database_persistence")
fun jdbcClientApplicationRepository(jdbcTemplate: JdbcTemplate, objectMapper: ObjectMapper) : ClientApplicationRepository =
JdbcClientApplicationRepository(jdbcTemplate, objectMapper)

@Bean("clientApplicationRepository")
@ConditionalOnProperty(
name = ["vauthenticator.dynamo-db.client-application.cache.enabled"],
havingValue = "false",
matchIfMissing = true
)
fun clientApplicationRepository(
@Profile("!experimental_database_persistence")
fun dynamoDbClientApplicationRepository(
dynamoDbClient: DynamoDbClient,
passwordEncoder: PasswordEncoder,
objectMapper: ObjectMapper,
@Value("\${vauthenticator.dynamo-db.client-application.table-name}") clientAppTableName: String
) = DynamoDbClientApplicationRepository(dynamoDbClient, clientAppTableName)

Expand All @@ -42,9 +51,9 @@ class ClientApplicationConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!experimental_database_persistence")
fun cachedClientApplicationRepository(
dynamoDbClient: DynamoDbClient,
passwordEncoder: PasswordEncoder,
clientApplicationCacheOperation: CacheOperation<String, String>,
objectMapper: ObjectMapper,
@Value("\${vauthenticator.dynamo-db.client-application.cache.enabled:false}") withCash: Boolean,
Expand All @@ -61,6 +70,7 @@ class ClientApplicationConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!experimental_database_persistence")
fun clientApplicationCacheOperation(
redisTemplate: RedisTemplate<*, *>,
@Value("\${vauthenticator.dynamo-db.client-application.cache.ttl}") ttl: Duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class PermissionConfig {
)
@Profile("!experimental_database_persistence")
fun dynamoDbRoleRepository(
mapper: ObjectMapper,
dynamoDbClient: DynamoDbClient,
@Value("\${vauthenticator.dynamo-db.role.table-name}") roleTableName: String,
@Value("\${vauthenticator.dynamo-db.role.protected-from-delete}") protectedRoleFromDeletion: List<String>
Expand Down

0 comments on commit 6b66f3c

Please sign in to comment.