Skip to content

Commit

Permalink
Handle empty prod values in maskinporten
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikpe committed Oct 10, 2024
1 parent 4ef8024 commit 7a9b185
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ private fun createM2mTokenClient(clientId: String, tokenEndpointUrl: String): Ma
else -> AzureAdTokenClientBuilder.builder().withNaisDefaults().buildMachineToMachineTokenClient()
}

fun createMaskinportenM2mTokenClient(clientId: String, tokenEndpointUrl: String, issuer: String): MaskinPortenTokenProvider =
fun createMaskinportenM2mTokenClient(clientId: String, tokenEndpointUrl: String, issuer: String): MaskinPortenTokenProvider? =
when (NaisEnv.current()) {
NaisEnv.Local -> MaskinPortenTokenProvider(
clientId = clientId,
tokenEndpointUrl = tokenEndpointUrl,
privateJwk = createMockRSAKey("maskinporten").toJSONString(),
issuer = issuer,
)
NaisEnv.ProdGCP -> null // TODO: Remove when prod
else -> MaskinPortenTokenProvider(
clientId = clientId,
tokenEndpointUrl = tokenEndpointUrl,
Expand Down
1 change: 0 additions & 1 deletion frontend/arena-adapter-manager/src/core/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export type MrApiTask =
| "initial-load-tiltaksgjennomforinger"
| "sync-navansatte"
| "sync-utdanning"
| "sync-arrangoransatte"
| "generate-refusjonskrav";

export const runTask = (base: ApiBase, task: MrApiTask, input?: object) =>
Expand Down
4 changes: 0 additions & 4 deletions frontend/arena-adapter-manager/src/pages/MrApiManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ export function MrApiManagement() {
Synkroniserer data fra utdanning.no.
</RunTask>

<RunTask base={ApiBase.MR_API} task={"sync-arrangoransatte"}>
Synkroniserer Arrangor-ansatte fra altinn-acl.
</RunTask>

<RunTask
base={ApiBase.MR_API}
task={"generate-refusjonskrav"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ import no.nav.mulighetsrommet.domain.dto.NorskIdent
import no.nav.mulighetsrommet.domain.serializers.LocalDateSerializer
import no.nav.mulighetsrommet.domain.serializers.LocalDateTimeSerializer
import no.nav.mulighetsrommet.domain.serializers.UUIDSerializer
import no.nav.pdfgen.core.Environment
import no.nav.pdfgen.core.PDFGenCore
import no.nav.pdfgen.core.pdf.createHtmlFromTemplateData
import no.nav.pdfgen.core.pdf.createPDFA
import org.koin.ktor.ext.inject
import org.verapdf.gf.foundry.VeraGreenfieldFoundryProvider
import java.time.LocalDate
import java.time.LocalDateTime
import java.util.*

fun Route.refusjonRoutes() {
// VeraGreenfieldFoundryProvider.initialise()
// PDFGenCore.init(
// Environment(),
// )
VeraGreenfieldFoundryProvider.initialise()
PDFGenCore.init(
Environment(),
)
val service: RefusjonService by inject()
val arrangorRolleService: ArrangorRolleService by inject()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import no.nav.mulighetsrommet.slack.SlackNotifierImpl
import no.nav.mulighetsrommet.tasks.DbSchedulerKotlinSerializer
import no.nav.mulighetsrommet.tokenprovider.AccessType
import no.nav.mulighetsrommet.tokenprovider.CachedTokenProvider
import no.nav.mulighetsrommet.tokenprovider.M2MTokenProvider
import no.nav.mulighetsrommet.tokenprovider.createMaskinportenM2mTokenClient
import no.nav.mulighetsrommet.unleash.UnleashService
import no.nav.mulighetsrommet.unleash.strategies.ByEnhetStrategy
Expand Down Expand Up @@ -274,10 +275,10 @@ private fun services(appConfig: AppConfig) = module {
baseUrl = appConfig.altinn.url,
altinnApiKey = appConfig.altinn.apiKey,
clientEngine = appConfig.engine,
tokenProvider = maskinportenTokenProvider.withScope(
tokenProvider = maskinportenTokenProvider?.withScope(
scope = appConfig.altinn.scope,
targetAudience = appConfig.altinn.url,
),
) ?: M2MTokenProvider { "dummy" }, // TODO: Remove when prod
)
}
single { EndringshistorikkService(get()) }
Expand Down
8 changes: 4 additions & 4 deletions mulighetsrommet-api/src/main/resources/application-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ app:
audience: ${TOKEN_X_CLIENT_ID}
tokenEndpointUrl: ${TOKEN_X_WELL_KNOWN_URL}
maskinporten:
issuer: ${MASKINPORTEN_ISSUER}
jwksUri: ${MASKINPORTEN_X_JWKS_URI}
audience: ${MASKINPORTEN_CLIENT_ID}
tokenEndpointUrl: ${MASKINPORTEN_TOKEN_ENDPOINT}
issuer: ${MASKINPORTEN_ISSUER:dummyremovewhenprod}
jwksUri: ${MASKINPORTEN_X_JWKS_URI:dummyremovewhenprod}
audience: ${MASKINPORTEN_CLIENT_ID:dummyremovewhenprod}
tokenEndpointUrl: ${MASKINPORTEN_TOKEN_ENDPOINT:dummyremovewhenprod}


sanity:
Expand Down

0 comments on commit 7a9b185

Please sign in to comment.