Skip to content

Commit

Permalink
use redirect URL for mailing actions
Browse files Browse the repository at this point in the history
verinice-veo#3003
  • Loading branch information
jj-sn committed Oct 15, 2024
1 parent 0d0b322 commit 80ab7cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/kotlin/org/veo/accounts/keycloak/AccountService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class AccountService(
private val facade: KeycloakFacade,
@Value("\${veo.accounts.keycloak.mailing.enabled}")
private val mailingEnabled: Boolean,
@Value("\${veo.accounts.keycloak.mailing.actionsRedirectUrl}")
private val mailActionsRedirectUrl: String,
@Value("\${veo.accounts.keycloak.clients.auth.name}")
private val userAuthKeycloakClient: String,
) {
fun findAllAccounts(authAccount: AuthenticatedAccount): List<UserRepresentation> =
facade.perform {
Expand Down Expand Up @@ -358,7 +362,12 @@ class AccountService(
.apply { if (!isEnabled) return }
.run { requiredActions + if (!isEmailVerified) listOf("VERIFY_EMAIL") else emptyList() }
.also { log.debug { "Determined email actions for user $accountId: $it" } }
.let { if (mailingEnabled) users().get(accountId).executeActionsEmail(it) }
.also { log.debug { "Mailing keycloak client: $userAuthKeycloakClient" } }
.also { log.debug { "Mailing actions redirect URL: $mailActionsRedirectUrl" } }
.let {
actions ->
if (mailingEnabled) users().get(accountId).executeActionsEmail(userAuthKeycloakClient, mailActionsRedirectUrl, actions)
}

private fun RealmResource.loadGroups(user: UserRepresentation) {
user.apply {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ spring.jndi.ignore=true
veo.accounts.keycloak.serverUrl=https://auth.staging.verinice.com/auth/
veo.accounts.keycloak.realm=verinice-veo
veo.accounts.keycloak.mailing.enabled=true
# After a user has completed mailing actions (e.g. email verification, password reset), this URL leads them to the actual veo web
# application.
veo.accounts.keycloak.mailing.actionsRedirectUrl=https://veo-web.develop.verinice.com/login
veo.accounts.keycloak.userSuperGroupName=veo-userclass
# veo.accounts.keycloak.proxyHost=cache.int.company.de
# veo.accounts.keycloak.proxyPort=3128
Expand Down

0 comments on commit 80ab7cc

Please sign in to comment.