Skip to content

Commit

Permalink
profile configuration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFlick72 committed Nov 16, 2024
1 parent 6f31c0d commit 5575220
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion local-environment/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ spring:
password: postgres
config:
activate:
on-profile: default
on-profile: database
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AccountConfig {


@Bean("accountRepository")
@Profile("aws")
@Profile("database")
fun jdbcAccountRepository(
jdbcTemplate: JdbcTemplate
) = JdbcAccountRepository(jdbcTemplate)
Expand All @@ -68,7 +68,7 @@ class AccountConfig {
havingValue = "false",
matchIfMissing = true
)
@Profile("!aws")
@Profile("dynamo")
fun dynamoDbAccountRepository(
mapper: ObjectMapper,
dynamoDbClient: DynamoDbClient,
Expand All @@ -85,7 +85,7 @@ class AccountConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!aws")
@Profile("dynamo")
fun cachedDynamoDbAccountRepository(
mapper: ObjectMapper,
dynamoDbClient: DynamoDbClient,
Expand All @@ -106,7 +106,7 @@ class AccountConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!aws")
@Profile("dynamo")
fun accountCacheOperation(
redisTemplate: RedisTemplate<*, *>,
@Value("\${vauthenticator.dynamo-db.account.cache.ttl}") ttl: Duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ class AuthorizationServerConfig {
}

@Bean("oAuth2AuthorizationService")
@Profile("!aws")
@Profile("!database")
fun redisOAuth2AuthorizationService(redisTemplate: RedisTemplate<Any, Any>): OAuth2AuthorizationService {
return RedisOAuth2AuthorizationService(redisTemplate)
}


@Bean("oAuth2AuthorizationService")
@Profile("aws")
@Profile("database")
fun jdbcOAuth2AuthorizationService(
jdbcTemplate : JdbcTemplate,
registeredClientRepository : RegisteredClientRepository
Expand Down
12 changes: 6 additions & 6 deletions src/main/kotlin/com/vauthenticator/server/keys/KeyConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ import java.util.*
@Configuration(proxyBeanMethods = false)
class KeyConfig {

@Profile("aws")
@Profile("kms")
@Bean("keyGenerator")
fun kmsKeyGenerator(kmsClient: KmsClient): KeyGenerator = KmsKeyGenerator(kmsClient)

@Profile("!aws")
@Profile("!kms")
@Bean("keyGenerator")
fun bouncyCastleKeyGenerator(kmsClient: KmsClient): KeyGenerator = BouncyCastleKeyGenerator(
KeyCryptographicOperations(
BouncyCastleKeyGeneratorMasterKeyRepository()
)
)

@Profile("aws")
@Profile("kms")
@Bean("keyDecrypter")
fun kmsKeyDecrypter(kmsClient: KmsClient): KeyDecrypter = KmsKeyDecrypter(kmsClient)

@Profile("!aws")
@Profile("!kms")
@Bean("keyDecrypter")
fun bouncyCastleKeyDecrypter(): KeyDecrypter = BouncyCastleKeyDecrypter(
KeyCryptographicOperations(
Expand All @@ -47,7 +47,7 @@ class KeyConfig {
)

@Bean("keyStorage")
@Profile("aws")
@Profile("dynamo")
fun dynamoDbKeyStorage(
clock: Clock,
dynamoDbClient: DynamoDbClient,
Expand All @@ -56,7 +56,7 @@ class KeyConfig {
) = DynamoDbKeyStorage(clock, dynamoDbClient, signatureTableName, mfaTableName)

@Bean("keyStorage")
@Profile("!aws")
@Profile("database")
fun jdbcKeyStorage(jdbcTemplate: JdbcTemplate, clock: Clock) = JdbcKeyStorage(jdbcTemplate, clock)

@Bean("keyRepository")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.springframework.context.annotation.Profile
import org.springframework.stereotype.Service

@Service
@Profile("!aws")
@Profile("!kms")
class KeyInitJob(private val keyRepository: KeyRepository) : ApplicationRunner {

override fun run(args: ApplicationArguments?) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/vauthenticator/server/mfa/MfaConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import java.util.*
class MfaConfig {

@Bean("mfaAccountMethodsRepository")
@Profile("!aws")
@Profile("dynamo")
fun dynamoDbMfaAccountMethodsRepository(
keyRepository: KeyRepository,
dynamoDbClient: DynamoDbClient,
Expand All @@ -52,7 +52,7 @@ class MfaConfig {
) { MfaDeviceId(UUID.randomUUID().toString()) }

@Bean("mfaAccountMethodsRepository")
@Profile("aws")
@Profile("database")
fun jdbcMfaAccountMethodsRepository(
keyRepository: KeyRepository,
jdbcTemplate: JdbcTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ClientApplicationConfig {


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

Expand All @@ -39,7 +39,7 @@ class ClientApplicationConfig {
havingValue = "false",
matchIfMissing = true
)
@Profile("!aws")
@Profile("dynamo")
fun dynamoDbClientApplicationRepository(
dynamoDbClient: DynamoDbClient,
@Value("\${vauthenticator.dynamo-db.client-application.table-name}") clientAppTableName: String
Expand All @@ -51,7 +51,7 @@ class ClientApplicationConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!aws")
@Profile("dynamo")
fun cachedClientApplicationRepository(
dynamoDbClient: DynamoDbClient,
clientApplicationCacheOperation: CacheOperation<String, String>,
Expand All @@ -70,7 +70,7 @@ class ClientApplicationConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!aws")
@Profile("dynamo")
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 @@ -23,7 +23,7 @@ import java.time.Duration
class PermissionConfig {

@Bean("roleRepository")
@Profile("aws")
@Profile("database")
fun jdbcRoleRepository(
jdbcTemplate: JdbcTemplate,
@Value("\${vauthenticator.dynamo-db.role.protected-from-delete}") protectedRoleFromDeletion: List<String>
Expand All @@ -35,7 +35,7 @@ class PermissionConfig {
havingValue = "false",
matchIfMissing = true
)
@Profile("!aws")
@Profile("dynamo")
fun dynamoDbRoleRepository(
dynamoDbClient: DynamoDbClient,
@Value("\${vauthenticator.dynamo-db.role.table-name}") roleTableName: String,
Expand All @@ -49,7 +49,7 @@ class PermissionConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!aws")
@Profile("dynamo")
fun cachedDynamoDbRoleRepository(
mapper: ObjectMapper,
roleCacheOperation: CacheOperation<String, String>,
Expand All @@ -68,7 +68,7 @@ class PermissionConfig {
havingValue = "true",
matchIfMissing = false
)
@Profile("!aws")
@Profile("dynamo")
fun roleCacheOperation(
redisTemplate: RedisTemplate<*, *>,
@Value("\${vauthenticator.dynamo-db.role.cache.ttl}") ttl: Duration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import java.util.*
class TicketConfig {

@Bean("ticketRepository")
@Profile("!aws")
@Profile("dynamo")
fun dynamoDbTicketRepository(
@Value("\${vauthenticator.dynamo-db.ticket.table-name}") tableName: String,
dynamoDbClient: DynamoDbClient
) = DynamoDbTicketRepository(dynamoDbClient, tableName)


@Bean("ticketRepository")
@Profile("aws")
@Profile("database")
fun jdbCTicketRepository(
jdbcTemplate: JdbcTemplate,
objectMapper: ObjectMapper
Expand Down

0 comments on commit 5575220

Please sign in to comment.