Skip to content

Commit

Permalink
Rename scope -> scopes (#182)
Browse files Browse the repository at this point in the history
Endre scope -> scopes ved flere anledninger

I hovedsak gjort på grunn av endring i forventet miljøvariabelnavn. Gir uansett mening ettersom man kan ha flere scopes i et JWT scope.
  • Loading branch information
anderssonw authored Jan 8, 2025
1 parent bc01926 commit c44639c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ abstract class TestApplicationWithDb {
"matrikkel.useStub" to "true",
"maskinporten.issuer" to mockOAuthServer.issuerUrl("testIssuer").toString(),
"maskinporten.jwksUri" to mockOAuthServer.jwksUrl("testIssuer").toString(),
"maskinporten.scope" to "kartverket:riktig:scope",
"maskinporten.scopes" to "kartverket:riktig:scope",
"maskinporten.shouldSkip" to "false"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import no.kartverket.matrikkel.bygning.infrastructure.database.runFlywayMigratio
import no.kartverket.matrikkel.bygning.infrastructure.matrikkel.MatrikkelApiConfig
import no.kartverket.matrikkel.bygning.infrastructure.matrikkel.createBygningClient
import no.kartverket.matrikkel.bygning.plugins.AuthenticationConfig
import no.kartverket.matrikkel.bygning.plugins.configureMaskinportenAuthentication
import no.kartverket.matrikkel.bygning.plugins.configureHTTP
import no.kartverket.matrikkel.bygning.plugins.configureMaskinportenAuthentication
import no.kartverket.matrikkel.bygning.plugins.configureMonitoring
import no.kartverket.matrikkel.bygning.plugins.configureOpenAPI
import no.kartverket.matrikkel.bygning.plugins.configureStatusPages
Expand Down Expand Up @@ -62,7 +62,7 @@ fun Application.mainModule() {
AuthenticationConfig(
jwksUri = config.property("maskinporten.jwksUri").getString(),
issuer = config.property("maskinporten.issuer").getString(),
requiredScope = config.property("maskinporten.scope").getString(),
requiredScopes = config.property("maskinporten.scopes").getString(),
shouldSkip = config.propertyOrNull("maskinporten.shouldSkip")?.getString().toBoolean(),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fun Application.configureMaskinportenAuthentication(config: AuthenticationConfig

verifier(jwkProvider, config.issuer) {
acceptLeeway(3)
withClaim("scope", config.requiredScope)
withClaim("scope", config.requiredScopes)
}
validate { it }
}
Expand All @@ -33,7 +33,7 @@ fun Application.configureMaskinportenAuthentication(config: AuthenticationConfig
data class AuthenticationConfig(
val jwksUri: String,
val issuer: String,
val requiredScope: String,
val requiredScopes: String,
private val shouldSkip: Boolean = false,
) {
fun shouldSkipAuthentication(): Boolean {
Expand Down
2 changes: 1 addition & 1 deletion web/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ matrikkel {
maskinporten {
jwksUri = ${MASKINPORTEN_JWKS_URI}
issuer = ${MASKINPORTEN_ISSUER}
scope = ${MASKINPORTEN_SCOPE}
scopes = ${MASKINPORTEN_SCOPES}
}

0 comments on commit c44639c

Please sign in to comment.