Skip to content

Commit

Permalink
Merge pull request #67 from hmrc/GG-4974
Browse files Browse the repository at this point in the history
GG-4974: changed references to allowlist
  • Loading branch information
AadilAkhtar authored Sep 1, 2020
2 parents fed86dc + 8c6c2a1 commit 7fd4ee7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ case class APIAccessVersions(versionConfigs: Option[ConfigObject]) {

val accessType = if (value.hasPath("type")) value.getString("type") else "PRIVATE"
val status = if (value.hasPath("status")) value.getString("status") else throw new IllegalArgumentException("Status missing")
val whiteListedApplicationIds = if (value.hasPath("white-list.applicationIds")) Some(value.getStringList("white-list.applicationIds").asScala.toList) else None
val allowListedApplicationIds = if (value.hasPath("white-list.applicationIds")) Some(value.getStringList("white-list.applicationIds").asScala.toList) else None
val endpointsEnabled = if (value.hasPath("endpointsEnabled")) value.getBoolean("endpointsEnabled") else false
val versionNumber = version.replace('_', '.')

new APIAccessConfig(versionNumber, status, accessType, endpointsEnabled, whiteListedApplicationIds.getOrElse(List()))
new APIAccessConfig(versionNumber, status, accessType, endpointsEnabled, allowListedApplicationIds.getOrElse(List()))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

package uk.gov.hmrc.openidconnect.userinfo.domain

case class APIAccess(`type`: String, whitelistedApplicationIds: Option[Seq[String]])
case class APIAccess(`type`: String, allowlistedApplicationIds: Option[Seq[String]])
22 changes: 11 additions & 11 deletions test/it/PlatformIntegrationISpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ class PlatformIntegrationISpec (implicit val wsClient: WSClient) extends BaseFea
versions.value.foreach { version =>
(version \ "version").get.as[String] match {
case "1.0" =>
val (status, endpointsEnabled, accessType, whitelistIds) = extractVersionToVerify(version)
val (status, endpointsEnabled, accessType, allowlistIds) = extractVersionToVerify(version)
status shouldBe "STABLE"
endpointsEnabled shouldBe true
accessType shouldBe "PRIVATE"
whitelistIds.size shouldBe 3
whitelistIds should contain ("649def0f-3ed3-4df5-8ae1-3e687a9143ea")
whitelistIds should contain ("df8c10db-01fb-4543-b77e-859267462231")
whitelistIds should contain ("9a32c713-7741-4aae-b39d-957021fb97a9")
allowlistIds.size shouldBe 3
allowlistIds should contain ("649def0f-3ed3-4df5-8ae1-3e687a9143ea")
allowlistIds should contain ("df8c10db-01fb-4543-b77e-859267462231")
allowlistIds should contain ("9a32c713-7741-4aae-b39d-957021fb97a9")
case "1.1" =>
val (status, endpointsEnabled, accessType, whitelistIds) = extractVersionToVerify(version)
val (status, endpointsEnabled, accessType, allowlistIds) = extractVersionToVerify(version)
status shouldBe "BETA"
endpointsEnabled shouldBe false
accessType shouldBe "PRIVATE"
whitelistIds.size shouldBe 1
whitelistIds should contain ("649def0f-3ed3-4df5-8ae1-3e687a9143ea")
allowlistIds.size shouldBe 1
allowlistIds should contain ("649def0f-3ed3-4df5-8ae1-3e687a9143ea")
case versionId => fail(s"An unknown version is found $versionId")
}
}
Expand All @@ -96,11 +96,11 @@ class PlatformIntegrationISpec (implicit val wsClient: WSClient) extends BaseFea
val status = (version \ "status").get.as[String]
val endpointsEnabled = (version \ "endpointsEnabled").get.as[Boolean]
val accessType = (version \ "access" \ "type").get.as[String]
val whitelistIds = (version \ "access" \ "whitelistedApplicationIds") match {
val allowlistIds = (version \ "access" \ "allowlistedApplicationIds") match {
case JsDefined(arr: JsArray) => arr.value.map(_.as[String]).toList
case _ => fail("Invalid whitelisted Application Ids definition")
case _ => fail("Invalid allowlisted Application Ids definition")
}
(status, endpointsEnabled, accessType, whitelistIds)
(status, endpointsEnabled, accessType, allowlistIds)
}

}

0 comments on commit 7fd4ee7

Please sign in to comment.