Skip to content

Commit

Permalink
updated role name
Browse files Browse the repository at this point in the history
  • Loading branch information
lalithanagarur committed Jan 23, 2025
1 parent cffd040 commit 3b3e5b4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
.components(
Components().addSecuritySchemes(
"template-kotlin-ui-role",
SecurityScheme().addBearerJwtRequirement("ROLE_LEARNER_RECORDS_SEARCH__RW"),
SecurityScheme().addBearerJwtRequirement("ROLE_LEARNER_RECORDS_SEARCH__R"),
),
)
.addSecurityItem(SecurityRequirement().addList("template-kotlin-ui-role", listOf("read")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import uk.gov.justice.digital.hmpps.learnerrecordsapi.openapi.FindByDemographicA
import uk.gov.justice.digital.hmpps.learnerrecordsapi.service.LRSService

@RestController
@PreAuthorize("hasRole('ROLE_LEARNER_RECORDS_SEARCH__RW')")
@PreAuthorize("hasRole('ROLE_LEARNER_RECORDS_SEARCH__R')")
@RequestMapping(value = ["/learners"], produces = ["application/json"])
class LearnersResource(
private val lrsService: LRSService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import uk.gov.justice.digital.hmpps.learnerrecordsapi.openapi.FindByULNApi
import uk.gov.justice.digital.hmpps.learnerrecordsapi.service.PLRService

@RestController
@PreAuthorize("hasRole('ROLE_LEARNER_RECORDS_SEARCH__RW')")
@PreAuthorize("hasRole('ROLE_LEARNER_RECORDS_SEARCH__R')")
@RequestMapping(value = ["/plr"], produces = ["application/json"])
class PLRResource(
private val plrService: PLRService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/learners")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(findLearnerByDemographicsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -74,7 +74,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/learners")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(findLearnerByDemographicsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -109,7 +109,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/learners")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(findLearnerByDemographicsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -144,7 +144,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/learners")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(findLearnerByDemographicsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -179,7 +179,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/someotherEndpoint")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(findLearnerByDemographicsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -217,7 +217,7 @@ class HmppsBoldLrsExceptionHandlerTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/learners")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.contentType(MediaType.APPLICATION_JSON)
.bodyValue(requestJsonWithoutGivenName)
.accept(MediaType.parseMediaType("application/json"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LearnersResourceIntTest : IntegrationTestBase() {
private fun actualResponse(request: FindLearnerByDemographicsRequest = findLearnerByDemographicsRequest, expectedStatus: Int = 200): String? {
val executedRequest = webTestClient.post()
.uri("/learners")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(request)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
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__RW"])
@CsvSource(value = ["template-kotlin-ui-role, ROLE_LEARNER_RECORDS_SEARCH__R"])
fun `the security scheme is setup for bearer tokens`(key: String, role: String) {
webTestClient.get()
.uri("/v3/api-docs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PLRResourceIntTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/plr")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(getLearningEventsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -79,7 +79,7 @@ class PLRResourceIntTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/plr")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(getLearningEventsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -130,7 +130,7 @@ class PLRResourceIntTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/plr")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(getLearningEventsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -158,7 +158,7 @@ class PLRResourceIntTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/plr")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(getLearningEventsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down Expand Up @@ -186,7 +186,7 @@ class PLRResourceIntTest : IntegrationTestBase() {

val actualResponse = webTestClient.post()
.uri("/plr")
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__RW")))
.headers(setAuthorisation(roles = listOf("ROLE_LEARNER_RECORDS_SEARCH__R")))
.bodyValue(getLearningEventsRequest)
.accept(MediaType.parseMediaType("application/json"))
.exchange()
Expand Down

0 comments on commit 3b3e5b4

Please sign in to comment.