Skip to content

Commit

Permalink
change role
Browse files Browse the repository at this point in the history
  • Loading branch information
Ewan Donovan committed Jan 27, 2025
1 parent 9ead4da commit 43bc6f6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
// service authorisation requirements
.components(
Components().addSecuritySchemes(
"template-kotlin-ui-role",
"learner-records-search-read-only-role",
SecurityScheme().addBearerJwtRequirement("ROLE_LEARNER_RECORDS_SEARCH__RO"),
),
)
.addSecurityItem(SecurityRequirement().addList("template-kotlin-ui-role", listOf("read")))
.addSecurityItem(SecurityRequirement().addList("learner-records-search-read-only-role", listOf("read")))
}

private fun SecurityScheme.addBearerJwtRequirement(role: String): SecurityScheme = type(SecurityScheme.Type.HTTP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fun readResourceFile(fileName: String): String {
),
],
),
security = [SecurityRequirement(name = "template-kotlin-ui-role")],
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
responses = [
ApiResponse(
responseCode = "200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
),
],
),
security = [SecurityRequirement(name = "template-kotlin-ui-role")],
security = [SecurityRequirement(name = "learner-records-search-read-only-role")],
responses = [
ApiResponse(
responseCode = "200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class OpenApiDocsTest : IntegrationTestBase() {
}

@ParameterizedTest
@CsvSource(value = ["template-kotlin-ui-role, ROLE_LEARNER_RECORDS_SEARCH__RO"])
@CsvSource(value = ["learner-records-search-read-only-role, ROLE_LEARNER_RECORDS_SEARCH__RO"])
fun `the security scheme is setup for bearer tokens`(key: String, role: String) {
webTestClient.get()
.uri("/v3/api-docs")
Expand Down

0 comments on commit 43bc6f6

Please sign in to comment.