-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gjøre det mulig å hente toggles i tiltaksansvarlig flate
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
bff-nav_ansatt/src/main/kotlin/no/nav/amt/tiltak/bff/nav_ansatt/UnleashController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package no.nav.amt.tiltak.bff.nav_ansatt | ||
|
||
import no.nav.amt.tiltak.common.auth.Issuer | ||
import no.nav.amt.tiltak.core.port.UnleashService | ||
import no.nav.security.token.support.core.api.ProtectedWithClaims | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestParam | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController("UnleashControllerNavAnsatt") | ||
open class UnleashController( | ||
private val unleash: UnleashService | ||
) { | ||
|
||
@ProtectedWithClaims(issuer = Issuer.AZURE_AD) | ||
@GetMapping("/api/nav-ansatt/unleash/feature") | ||
fun getToggles( | ||
@RequestParam(name = "features") features: List<String> | ||
): Map<String, Boolean> { | ||
val toggles = getFeaturetoggles(features) | ||
return toggles | ||
} | ||
|
||
fun getFeaturetoggles(features: List<String>): Map<String, Boolean> { | ||
return features.associateWith { unleash.isEnabled(it) } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters