Skip to content

Commit 0f461dc

Browse files
committed
Add support for changing auth url
1 parent a08fd10 commit 0f461dc

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

profiles/dev/config.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ jore4.db.max.connections=5
99
# jOOQ code generation configuration
1010
jooq.generator.db.dialect=org.jooq.meta.postgres.PostgresDatabase
1111
jooq.sql.dialect=POSTGRES
12+
13+
# Remote authentication URL
14+
authentication.url=http://jore4-auth:8080/public/v1/hasura/webhook
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package fi.hsl.jore4.timetables.config
2+
3+
import org.springframework.boot.context.properties.ConfigurationProperties
4+
5+
@ConfigurationProperties(prefix = "auth")
6+
data class AuthenticationProperties(
7+
val url: String
8+
)

src/main/kotlin/fi/hsl/jore4/timetables/config/RemoteAuthenticationProvider.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import java.net.http.HttpRequest
1515
import java.net.http.HttpResponse
1616

1717
@Configuration
18-
class RemoteAuthenticationProvider : AuthenticationProvider {
18+
class RemoteAuthenticationProvider(
19+
val authenticationProperties: AuthenticationProperties
20+
) : AuthenticationProvider {
1921

2022
companion object {
2123
val logger = KotlinLogging.logger {}
@@ -47,7 +49,7 @@ class RemoteAuthenticationProvider : AuthenticationProvider {
4749

4850
private fun authenticateWithHasuraWebhook(authentication: Authentication?): HttpResponse<String> {
4951
val authRequest = HttpRequest.newBuilder().run {
50-
uri(URI("http://jore4-auth:8080/public/v1/hasura/webhook"))
52+
uri(URI(authenticationProperties.url))
5153
headers("cookie", "SESSION=${authentication?.principal}", ROLE_HEADER, authentication?.credentials.toString(), "Accept", "application/json")
5254
header("cookie", "SESSION=${authentication?.principal}")
5355
header(ROLE_HEADER, authentication?.credentials.toString())

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ jore4.db.password=@jore4.db.password@
55
jore4.db.minConnections=@jore4.db.min.connections@
66
jore4.db.maxConnections=@jore4.db.max.connections@
77
jooq.sql.dialect=@jooq.sql.dialect@
8+
authentication.url=@authentication.url@

0 commit comments

Comments
 (0)