Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kun tilgang med OBO for a-inntekt #6502

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions apps/etterlatte-api/.nais/dev-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,18 @@ spec:
- application: arbeid-og-inntekt
namespace: team-inntekt
cluster: dev-fss
permissions:
roles:
- les-oms-sak-for-person
- application: arbeid-og-inntekt-q1
namespace: team-inntekt
cluster: dev-fss
permissions:
roles:
- les-oms-sak-for-person
- application: arbeid-og-inntekt-q2
namespace: team-inntekt
cluster: dev-fss
permissions:
roles:
- les-oms-sak-for-person
- application: arbeid-og-inntekt-q4
namespace: team-inntekt
cluster: dev-fss
permissions:
roles:
- les-oms-sak-for-person
- application: arbeid-og-inntekt-ascension
namespace: team-inntekt
cluster: dev-fss
permissions:
roles:
- les-oms-sak-for-person
- application: pensjon-pen-q0
namespace: pensjon-q0
cluster: dev-fss
Expand Down
3 changes: 0 additions & 3 deletions apps/etterlatte-api/.nais/prod-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ spec:
- application: arbeid-og-inntekt
namespace: team-inntekt
cluster: prod-fss
permissions:
roles:
- les-oms-sak-for-person
- application: pensjon-pen
namespace: pensjondeployer
cluster: prod-fss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@ import no.nav.etterlatte.libs.ktor.route.SAKID_CALL_PARAMETER
import no.nav.etterlatte.libs.ktor.route.sakId
import no.nav.etterlatte.libs.ktor.token.Issuer

private fun generateRoles(config: Config): Set<String> {
val defaultRoles =
setOf(
config.getString("roller.pensjon-saksbehandler"),
config.getString("roller.gjenny-saksbehandler"),
)
// TODO: les-oms-sak-for-person kan fjernes siden de kaller oss med OBO......
return defaultRoles + "les-oms-sak-for-person"
}
private fun generateGjennyRoller(config: Config): Set<String> =
setOf(
config.getString("roller.pensjon-saksbehandler"),
config.getString("roller.gjenny-saksbehandler"),
)

fun Route.behandlingSakRoutes(
behandlingService: BehandlingService,
config: Config,
) {
route("api/oms") {
install(AuthorizationPlugin) {
accessPolicyRolesEllerAdGrupper = generateRoles(config)
accessPolicyRolesEllerAdGrupper = generateGjennyRoller(config)
issuers = setOf(Issuer.AZURE.issuerName)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,30 +108,6 @@ class BehandlingSakRoutesTest {
}
}

@Test
fun `skal gi 500 når body mangler rolle les-oms-sak-for-person(kun dev)`() {
val conff = configMedRoller(mockOAuth2Server.config.httpServer.port(), Issuer.AZURE.issuerName)
testApplication {
runServerWithConfig(applicationConfig = conff) {
behandlingSakRoutes(
behandlingService = behandlingService,
config = conff,
)
}

val response =
client.post("api/oms/person/sak") {
contentType(ContentType.Application.Json)
header(
HttpHeaders.Authorization,
"Bearer ${mockOAuth2Server.issueSaksbehandlerToken(groups = listOf("les-oms-sak-for-person"))}",
)
}
response.status shouldBe HttpStatusCode.InternalServerError
coVerify(exactly = 0) { behandlingService.hentSakforPerson(any()) }
}
}

@Test
fun `skal gi 500 når body mangler pensjonSaksbehandler`() {
val pensjonSaksbehandler = UUID.randomUUID().toString()
Expand Down