From b81cb3edf5ce2e61b383c6a890e55c3120fe5c0e Mon Sep 17 00:00:00 2001 From: Radoslaw Busz Date: Thu, 31 Aug 2017 13:19:51 +0100 Subject: [PATCH 1/4] PE-3153 - Cleanup --- .../userinfo/connectors/AuthConnector.scala | 52 ++-- ...hirdPartyDelegatedAuthorityConnector.scala | 4 +- .../testOnly/FeatureSwitchController.scala | 2 +- .../userinfo/domain/UserInfo.scala | 17 +- .../userinfo/domain/package.scala | 8 - .../userinfo/services/CountryService.scala | 37 --- conf/resources/country.json | 273 ------------------ project/MicroserviceBuild.scala | 2 +- test/it/PlatformIntegrationSpec.scala | 2 +- test/it/UserInfoServiceSpec.scala | 4 - test/it/stubs/AuthStub.scala | 23 -- .../controllers/ErrorResponseSpec.scala | 2 +- .../userinfo/data/UserInfoGeneratorSpec.scala | 4 +- .../services/UserInfoTransformerSpec.scala | 1 - 14 files changed, 36 insertions(+), 395 deletions(-) delete mode 100644 app/uk/gov/hmrc/openidconnect/userinfo/services/CountryService.scala delete mode 100644 conf/resources/country.json diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala b/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala index 34df1fd..8cd3bab 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala @@ -28,7 +28,7 @@ import uk.gov.hmrc.play.http.{HeaderCarrier, HttpGet, NotFoundException} import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future -trait AuthConnector extends uk.gov.hmrc.play.auth.microservice.connectors.AuthConnector with AuthorisedFunctions{ +trait AuthConnector extends uk.gov.hmrc.play.auth.microservice.connectors.AuthConnector with AuthorisedFunctions { val authBaseUrl: String val http: HttpGet @@ -58,35 +58,37 @@ trait AuthConnector extends uk.gov.hmrc.play.auth.microservice.connectors.AuthCo agentFriendlyName = agentInformation.agentFriendlyName, credentialRole = credentialRole.map(_.toString), description = description, groupIdentifier = groupId, agentId = agentInformation.agentId))) case _ => Future.successful(None) + }.recover { + case e: NotFoundException => None } - } - def fetchDesUserInfo(authority: Authority)(implicit hc: HeaderCarrier): Future[Option[DesUserInfo]] = { - val nothing = Future.successful(None) - if (authority.nino.isDefined) - authorised().retrieve(Retrievals.allItmpUserDetails) { - case name ~ dateOfBirth ~ address => - Future.successful(Some(DesUserInfo(name, dateOfBirth, address))) - case _ => nothing - }.recoverWith { - case ex: NotFoundException => nothing - } - else nothing - } + def fetchDesUserInfo(authority: Authority)(implicit hc: HeaderCarrier): Future[Option[DesUserInfo]] = { + val nothing = Future.successful(None) + if (authority.nino.isDefined) + authorised().retrieve(Retrievals.allItmpUserDetails) { + case name ~ dateOfBirth ~ address => + Future.successful(Some(DesUserInfo(name, dateOfBirth, address))) + case _ => nothing + }.recoverWith { + case ex: NotFoundException => nothing + } + else nothing + } - def fetchAuthority()(implicit headerCarrier: HeaderCarrier): Future[Option[Authority]] = { - http.GET(s"$authBaseUrl/auth/authority") map { response => - response.json.asOpt[Authority] + def fetchAuthority()(implicit headerCarrier: HeaderCarrier): Future[Option[Authority]] = { + http.GET(s"$authBaseUrl/auth/authority") map { response => + response.json.asOpt[Authority] + } } } -} -object AuthConnector extends AuthConnector with ServicesConfig { - override lazy val authBaseUrl = baseUrl("auth") - lazy val http = WSHttp + object AuthConnector extends AuthConnector with ServicesConfig { + override lazy val authBaseUrl = baseUrl("auth") + lazy val http = WSHttp - override def authConnector = new PlayAuthConnector { - override val serviceUrl = baseUrl("auth") - override def http = WSHttp + override def authConnector = new PlayAuthConnector { + override val serviceUrl = baseUrl("auth") + + override def http = WSHttp + } } -} diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala b/app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala index 1a84a83..65b5bc9 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/connectors/ThirdPartyDelegatedAuthorityConnector.scala @@ -18,9 +18,9 @@ package uk.gov.hmrc.openidconnect.userinfo.connectors import uk.gov.hmrc.openidconnect.userinfo.config.WSHttp import uk.gov.hmrc.play.config.ServicesConfig -import uk.gov.hmrc.play.http.{NotFoundException, HeaderCarrier, HttpGet} -import scala.concurrent.ExecutionContext.Implicits.global +import uk.gov.hmrc.play.http.{HeaderCarrier, HttpGet, NotFoundException} +import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.Future trait ThirdPartyDelegatedAuthorityConnector { diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala b/app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala index edfc90d..a56fa6b 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/controllers/testOnly/FeatureSwitchController.scala @@ -21,8 +21,8 @@ import play.api.mvc.Action import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} import uk.gov.hmrc.play.microservice.controller.BaseController -import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.Future trait FeatureSwitchController extends BaseController { diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala index 9157d7b..c1d7725 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala @@ -45,19 +45,4 @@ case class UserProfile(given_name: Option[String], case class DesUserInfo(name: ItmpName, dateOfBirth: Option[LocalDate], - address: ItmpAddress) - -//case class DesUserName(firstForenameOrInitial: Option[String], -// secondForenameOrInitial: Option[String], -// surname: Option[String]) -// -//case class DesAddress(line1: Option[String], -// line2: Option[String], -// line3: Option[String], -// line4: Option[String], -// line5: Option[String], -// postcode: Option[String], -// countryCode: Option[Int]) -// -//case class Country(shortName: Option[String], -// alphaTwoCode: Option[String]) + address: ItmpAddress) \ No newline at end of file diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala index 99d7f67..f86fb6d 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala @@ -16,8 +16,6 @@ package uk.gov.hmrc.openidconnect.userinfo -import org.joda.time.LocalDate -import play.api.libs.functional.syntax._ import play.api.libs.json._ import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName} import uk.gov.hmrc.play.http.Token @@ -28,12 +26,6 @@ package object domain { implicit val desAddress = Json.format[ItmpAddress] -// implicit val desUserInfo : Reads[DesUserInfo] = ( -// (JsPath \ "names" \ "1").read[ItmpName] and -// (JsPath \ "dateOfBirth").readNullable[LocalDate] and -// (JsPath \ "addresses" \ "1").read[ItmpAddress] -// )(DesUserInfo.apply _) - implicit val enrolmentIdentifier = Json.format[EnrolmentIdentifier] implicit val enrloment = Json.format[Enrolment] diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/services/CountryService.scala b/app/uk/gov/hmrc/openidconnect/userinfo/services/CountryService.scala deleted file mode 100644 index ec6b87e..0000000 --- a/app/uk/gov/hmrc/openidconnect/userinfo/services/CountryService.scala +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package uk.gov.hmrc.openidconnect.userinfo.services - -//import scala.io.Source -// -//trait CountryService { -// -// val countries: Map[String, Country] -// -// def getCountry(countryCode: Int): Option[Country] = countries.get(countryCode.toString) -//} -// -//object CountryService extends CountryService { -// override val countries = loadCountriesFromFile("/resources/country.json") -// -// private def loadCountriesFromFile(file: String) = { -// val is = getClass.getResourceAsStream(file) -// try { -// Json.parse(Source.fromInputStream(is).mkString).as[Map[String, Country]] -// } finally is.close() -// } -//} diff --git a/conf/resources/country.json b/conf/resources/country.json deleted file mode 100644 index c6d9e16..0000000 --- a/conf/resources/country.json +++ /dev/null @@ -1,273 +0,0 @@ -{ - "1": {"short_name": "GREAT BRITAIN", "alpha_two_code": "GB"}, - "2": {"short_name": "GIBRALTAR", "alpha_two_code": "GI"}, - "3": {"short_name": "GUERNSEY", "alpha_two_code": "GG"}, - "4": {"short_name": "JERSEY", "alpha_two_code": "JE"}, - "5": {"short_name": "MALTA", "alpha_two_code": "MT"}, - "6": {"short_name": "SARK", "alpha_two_code": "GG"}, - "7": {"short_name": "ISLE OF MAN", "alpha_two_code": "IM"}, - "8": {"short_name": "NORTHERN IRELAND", "alpha_two_code": "GB-NIR"}, - "9": {"short_name": "TOURS", "alpha_two_code": ""}, - "10": {"short_name": "ALDERNEY", "alpha_two_code": "GG"}, - "11": {"short_name": "ANTIGUA", "alpha_two_code": "AG"}, - "12": {"short_name": "AUSTRALIA", "alpha_two_code": "AU"}, - "13": {"short_name": "BAHAMAS", "alpha_two_code": "BS"}, - "14": {"short_name": "BARBADOS", "alpha_two_code": "BB"}, - "15": {"short_name": "BERMUDA", "alpha_two_code": "BM"}, - "16": {"short_name": "MALDIVE ISLANDS", "alpha_two_code": "MV"}, - "17": {"short_name": "CAYMAN ISLANDS", "alpha_two_code": "KY"}, - "18": {"short_name": "COOK ISLANDS", "alpha_two_code": "CK"}, - "19": {"short_name": "COMMONWEALTH OF DOMINICA", "alpha_two_code": "DM"}, - "20": {"short_name": "FALKLAND ISLANDS", "alpha_two_code": "FK"}, - "21": {"short_name": "FIJI", "alpha_two_code": "FJ"}, - "22": {"short_name": "KIRIBATI", "alpha_two_code": "KI"}, - "23": {"short_name": "JAMAICA", "alpha_two_code": "JM"}, - "24": {"short_name": "HONG KONG", "alpha_two_code": "HK"}, - "25": {"short_name": "MAURITIUS", "alpha_two_code": "MU"}, - "26": {"short_name": "MONTSERRAT", "alpha_two_code": "MS"}, - "27": {"short_name": "VANUATU", "alpha_two_code": "VU"}, - "28": {"short_name": "NEW ZEALAND", "alpha_two_code": "NZ"}, - "29": {"short_name": "NORFOLK ISLAND", "alpha_two_code": "NF"}, - "30": {"short_name": "PAPUA NEW GUINEA", "alpha_two_code": "PG"}, - "31": {"short_name": "ST HELENA & DEPNDS", "alpha_two_code": "SH"}, - "32": {"short_name": "NEVIS,ST KITTS-NEVIS", "alpha_two_code": "KN"}, - "33": {"short_name": "ST VINCENT & GRENADINES", "alpha_two_code": "VS"}, - "34": {"short_name": "SEYCHELLES", "alpha_two_code": "SC"}, - "35": {"short_name": "SOLOMON ISLANDS", "alpha_two_code": "SB"}, - "36": {"short_name": "TUVALU", "alpha_two_code": "TV"}, - "37": {"short_name": "TRINIDAD & TOBAGO", "alpha_two_code": "TT"}, - "38": {"short_name": "TURKS & CAICOS ISLANDS", "alpha_two_code": "TC"}, - "39": {"short_name": "VIRGIN ISLANDS (BRITISH)", "alpha_two_code": "VG"}, - "40": {"short_name": "WESTERN SAMOA", "alpha_two_code": "WS"}, - "41": {"short_name": "ANGUILLA", "alpha_two_code": "AI"}, - "42": {"short_name": "GRENADA", "alpha_two_code": "GD"}, - "43": {"short_name": "ST LUCIA", "alpha_two_code": "LC"}, - "44": {"short_name": "NAURU", "alpha_two_code": "NR"}, - "45": {"short_name": "GREENLAND", "alpha_two_code": "GL"}, - "46": {"short_name": "CANADA", "alpha_two_code": "CA"}, - "47": {"short_name": "GUAM", "alpha_two_code": "GU"}, - "48": {"short_name": "ASCENCION ISLAND", "alpha_two_code": "SH-AC"}, - "49": {"short_name": "BAHRAIN", "alpha_two_code": "BH"}, - "50": {"short_name": "BOTSWANA", "alpha_two_code": "BW"}, - "51": {"short_name": "BRUNEI", "alpha_two_code": "BN"}, - "52": {"short_name": "BURMA", "alpha_two_code": "BU"}, - "53": {"short_name": "SRI LANKA", "alpha_two_code": "LK"}, - "54": {"short_name": "BHUTAN", "alpha_two_code": "BT"}, - "55": {"short_name": "GAMBIA", "alpha_two_code": "GM"}, - "56": {"short_name": "GHANA", "alpha_two_code": "GH"}, - "57": {"short_name": "GUYANA", "alpha_two_code": "GY"}, - "58": {"short_name": "ANTARCTIC TERRITORIES (BRITISH)", "alpha_two_code": "BQ"}, - "59": {"short_name": "INDIA", "alpha_two_code": "IN"}, - "60": {"short_name": "JORDAN", "alpha_two_code": "JO"}, - "61": {"short_name": "KENYA", "alpha_two_code": "KE"}, - "62": {"short_name": "KUWAIT", "alpha_two_code": "KW"}, - "63": {"short_name": "LESOTHO", "alpha_two_code": "LS"}, - "64": {"short_name": "LIBYA", "alpha_two_code": "LY"}, - "65": {"short_name": "MALAWI", "alpha_two_code": "MW"}, - "66": {"short_name": "MALAYSIA", "alpha_two_code": "MY"}, - "67": {"short_name": "OMAN", "alpha_two_code": "OM"}, - "68": {"short_name": "NIGERIA", "alpha_two_code": "NG"}, - "69": {"short_name": "PAKISTAN", "alpha_two_code": "PK"}, - "70": {"short_name": "DEMOCRATIC YEMEN", "alpha_two_code": "YE"}, - "71": {"short_name": "QATAR", "alpha_two_code": "QA"}, - "72": {"short_name": "SOUTH AFRICA", "alpha_two_code": "ZA"}, - "73": {"short_name": "SABAH", "alpha_two_code": "MY-12"}, - "74": {"short_name": "SARAWAK", "alpha_two_code": "MY-13"}, - "75": {"short_name": "SHARJAH", "alpha_two_code": "AE-SH"}, - "76": {"short_name": "SIERRA LEONE", "alpha_two_code": "SL"}, - "77": {"short_name": "SINGAPORE", "alpha_two_code": "SG"}, - "78": {"short_name": "SWAZILAND", "alpha_two_code": "SZ"}, - "79": {"short_name": "TANZANIA", "alpha_two_code": "TZ"}, - "80": {"short_name": "ARAB EMIRATES (UNITED)", "alpha_two_code": "AE"}, - "81": {"short_name": "UGANDA", "alpha_two_code": "UG"}, - "82": {"short_name": "ZAMBIA", "alpha_two_code": "ZM"}, - "83": {"short_name": "NAMIBIA", "alpha_two_code": "NA"}, - "84": {"short_name": "BANGLADESH", "alpha_two_code": "BD"}, - "85": {"short_name": "TONGA", "alpha_two_code": "TO"}, - "86": {"short_name": "BISSAU (GUINEA)", "alpha_two_code": "GW"}, - "87": {"short_name": "MONGOLIA", "alpha_two_code": "MN"}, - "88": {"short_name": "NORTH KOREA", "alpha_two_code": "KP"}, - "89": {"short_name": "PRINCIPE AND SAO TOME", "alpha_two_code": "ST"}, - "90": {"short_name": "CAPE VERDE ISLANDS", "alpha_two_code": "CV"}, - "91": {"short_name": "COMORO ISLANDS", "alpha_two_code": "KM"}, - "92": {"short_name": "EQUATORIAL GUINEA", "alpha_two_code": "GQ"}, - "93": {"short_name": "AMERICAN SAMOA", "alpha_two_code": "AI"}, - "94": {"short_name": "BARBUDA", "alpha_two_code": "AG-10"}, - "95": {"short_name": "VIRGIN ISLANDS (USA)", "alpha_two_code": "VI"}, - "96": {"short_name": "ST MARTINS", "alpha_two_code": "MF"}, - "97": {"short_name": "RUSSIAN FEDERATION", "alpha_two_code": "RU"}, - "98": {"short_name": "REPUBLIC OF ARMENIA", "alpha_two_code": "AM"}, - "99": {"short_name": "REPUBLIC OF BELARUS", "alpha_two_code": "BY"}, - "100": {"short_name": "REPUBLIC OF KAZAKHSTAN", "alpha_two_code": "KZ"}, - "101": {"short_name": "REPUBLIC OF KYRGYZSTAN", "alpha_two_code": "KG"}, - "102": {"short_name": "REPUBLIC OF MOLDOVA", "alpha_two_code": "MD"}, - "103": {"short_name": "REPUBLIC OF TAJIKISTAN", "alpha_two_code": "TJ"}, - "104": {"short_name": "REPUBLIC OF TURKMENISTAN", "alpha_two_code": "TM"}, - "105": {"short_name": "REPUBLIC OF UZBEKISTAN", "alpha_two_code": "UZ"}, - "106": {"short_name": "REPUBLIC OF AZERBAIJAN", "alpha_two_code": "AZ"}, - "107": {"short_name": "REPUBLIC OF ESTONIA", "alpha_two_code": "EE"}, - "108": {"short_name": "REPUBLIC OF GEORGIA", "alpha_two_code": "GE"}, - "109": {"short_name": "REPUBLIC OF LATVIA", "alpha_two_code": "LV"}, - "110": {"short_name": "REPUBLIC OF LITHUANIA", "alpha_two_code": "LT"}, - "111": {"short_name": "UKRAINE", "alpha_two_code": "UA"}, - "114": {"short_name": "ENGLAND", "alpha_two_code": "GB-ENG"}, - "115": {"short_name": "SCOTLAND", "alpha_two_code": "GB-SCT"}, - "116": {"short_name": "WALES", "alpha_two_code": "GW-WLS"}, - "117": {"short_name": "REPUBLIC OF IRELAND", "alpha_two_code": "IE"}, - "120": {"short_name": "CHANNEL ISLANDS", "alpha_two_code": ""}, - "121": {"short_name": "ANDORRA", "alpha_two_code": "AD"}, - "122": {"short_name": "AUSTRIA", "alpha_two_code": "AT"}, - "123": {"short_name": "BELGIUM", "alpha_two_code": "BE"}, - "124": {"short_name": "BULGARIA", "alpha_two_code": "BG"}, - "125": {"short_name": "CZECHOSLOVAKIA", "alpha_two_code": "CS"}, - "126": {"short_name": "DENMARK", "alpha_two_code": "DK"}, - "127": {"short_name": "FINLAND", "alpha_two_code": "FI"}, - "128": {"short_name": "FRANCE", "alpha_two_code": "FR"}, - "129": {"short_name": "EAST GERMANY", "alpha_two_code": "DD"}, - "130": {"short_name": "GERMANY", "alpha_two_code": "DE"}, - "131": {"short_name": "GREECE", "alpha_two_code": "GR"}, - "132": {"short_name": "HUNGARY", "alpha_two_code": "HU"}, - "133": {"short_name": "ITALY", "alpha_two_code": "IT"}, - "134": {"short_name": "LUXEMBOURG", "alpha_two_code": "LU"}, - "135": {"short_name": "NETHERLANDS", "alpha_two_code": "NL"}, - "136": {"short_name": "NORWAY", "alpha_two_code": "NO"}, - "137": {"short_name": "POLAND", "alpha_two_code": "PL"}, - "138": {"short_name": "PORTUGAL", "alpha_two_code": "PT"}, - "139": {"short_name": "ROMANIA", "alpha_two_code": "RO"}, - "140": {"short_name": "SPAIN", "alpha_two_code": "ES"}, - "141": {"short_name": "SWEDEN", "alpha_two_code": "SE"}, - "142": {"short_name": "SWITZERLAND", "alpha_two_code": "CH"}, - "143": {"short_name": "TURKEY", "alpha_two_code": "TR"}, - "144": {"short_name": "USSR", "alpha_two_code": "SU"}, - "145": {"short_name": "YUGOSLAVIA", "alpha_two_code": "YU"}, - "147": {"short_name": "MONACO", "alpha_two_code": "MC"}, - "148": {"short_name": "ALBANIA", "alpha_two_code": "AL"}, - "149": {"short_name": "CYPRUS", "alpha_two_code": "CY"}, - "150": {"short_name": "ICELAND", "alpha_two_code": "IS"}, - "151": {"short_name": "LIECHTENSTEIN", "alpha_two_code": "LI"}, - "152": {"short_name": "FAROE ISLANDS", "alpha_two_code": "FO"}, - "153": {"short_name": "SAN MARINO", "alpha_two_code": "SM"}, - "154": {"short_name": "VATICAN CITY STATE", "alpha_two_code": "VA"}, - "155": {"short_name": "REP OF BOSNIA-HERZEGOVINA", "alpha_two_code": "BA"}, - "156": {"short_name": "REPUBLIC OF CROATIA", "alpha_two_code": "HR"}, - "157": {"short_name": "FORMER YUG REP OF MACEDONIA", "alpha_two_code": "MK"}, - "158": {"short_name": "REPUBLIC OF SLOVENIA", "alpha_two_code": "SI"}, - "159": {"short_name": "FEDERAL REP OF YUGOSLAVIA", "alpha_two_code": "YU"}, - "161": {"short_name": "AFGHANISTAN", "alpha_two_code": "AF"}, - "162": {"short_name": "ALGERIA", "alpha_two_code": "DZ"}, - "163": {"short_name": "ANGOLA", "alpha_two_code": "AO"}, - "164": {"short_name": "ARGENTINA", "alpha_two_code": "AR"}, - "165": {"short_name": "BOLIVIA", "alpha_two_code": "BO"}, - "166": {"short_name": "BRAZIL", "alpha_two_code": "BR"}, - "167": {"short_name": "KAMPUCHEA", "alpha_two_code": "KH"}, - "168": {"short_name": "CAMEROON", "alpha_two_code": "CM"}, - "169": {"short_name": "CHILE", "alpha_two_code": "CL"}, - "170": {"short_name": "CHINA PEOPLES REPUBLIC", "alpha_two_code": "CN"}, - "171": {"short_name": "COLOMBIA", "alpha_two_code": "CO"}, - "172": {"short_name": "ZAIRE", "alpha_two_code": "ZR"}, - "173": {"short_name": "COSTA RICA", "alpha_two_code": "CR"}, - "174": {"short_name": "CUBA", "alpha_two_code": "CU"}, - "175": {"short_name": "DOMINICAN REPUBLIC", "alpha_two_code": "DO"}, - "176": {"short_name": "ECUADOR", "alpha_two_code": "EC"}, - "177": {"short_name": "EGYPT", "alpha_two_code": "EG"}, - "178": {"short_name": "EL SALVADOR", "alpha_two_code": "SV"}, - "179": {"short_name": "ETHIOPIA", "alpha_two_code": "ET"}, - "180": {"short_name": "TAIWAN", "alpha_two_code": "TW"}, - "181": {"short_name": "GUATEMALA", "alpha_two_code": "GT"}, - "182": {"short_name": "HAITI", "alpha_two_code": "HT"}, - "183": {"short_name": "BELIZE", "alpha_two_code": "BZ"}, - "184": {"short_name": "INDONESIA", "alpha_two_code": "ID"}, - "185": {"short_name": "IRAN", "alpha_two_code": "IR"}, - "186": {"short_name": "IRAQ", "alpha_two_code": "IQ"}, - "187": {"short_name": "ISRAEL", "alpha_two_code": "IL"}, - "188": {"short_name": "COTE D'IVOIRE", "alpha_two_code": "CI"}, - "189": {"short_name": "JAPAN", "alpha_two_code": "JP"}, - "190": {"short_name": "LEBANON", "alpha_two_code": "LB"}, - "191": {"short_name": "LIBERIA", "alpha_two_code": "LR"}, - "192": {"short_name": "MACAU", "alpha_two_code": "MO"}, - "193": {"short_name": "MALAGASY REPUBLIC", "alpha_two_code": "MG"}, - "194": {"short_name": "MEXICO", "alpha_two_code": "MX"}, - "195": {"short_name": "MOROCCO", "alpha_two_code": "MA"}, - "196": {"short_name": "MOZAMBIQUE", "alpha_two_code": "MZ"}, - "197": {"short_name": "NEPAL", "alpha_two_code": "NP"}, - "198": {"short_name": "ANTILLES (NETHERLANDS)", "alpha_two_code": "AN"}, - "199": {"short_name": "NEW CALEDONIA", "alpha_two_code": "NC"}, - "200": {"short_name": "NICARAGUA", "alpha_two_code": "NI"}, - "201": {"short_name": "PANAMA", "alpha_two_code": "PA"}, - "202": {"short_name": "PARAGUAY", "alpha_two_code": "PY"}, - "203": {"short_name": "PERU", "alpha_two_code": "PE"}, - "204": {"short_name": "PHILIPPINES", "alpha_two_code": "PH"}, - "205": {"short_name": "PUERTO RICO", "alpha_two_code": "PR"}, - "206": {"short_name": "ZIMBABWE", "alpha_two_code": "ZW"}, - "207": {"short_name": "SAUDI ARABIA", "alpha_two_code": "SA"}, - "208": {"short_name": "SENEGAL", "alpha_two_code": "SN"}, - "209": {"short_name": "SOMALIA", "alpha_two_code": "SO"}, - "210": {"short_name": "SOUTH KOREA", "alpha_two_code": "KR"}, - "211": {"short_name": "VIETNAM", "alpha_two_code": "VN"}, - "212": {"short_name": "SUDAN", "alpha_two_code": "SD"}, - "213": {"short_name": "SYRIA", "alpha_two_code": "SY"}, - "214": {"short_name": "THAILAND", "alpha_two_code": "TH"}, - "215": {"short_name": "TOGO", "alpha_two_code": "TG"}, - "216": {"short_name": "TUNISIA", "alpha_two_code": "TN"}, - "217": {"short_name": "URUGUAY", "alpha_two_code": "UY"}, - "218": {"short_name": "USA", "alpha_two_code": "US"}, - "219": {"short_name": "VENEZUELA", "alpha_two_code": "VE"}, - "220": {"short_name": "REPUBLIC OF YEMEN", "alpha_two_code": "YE"}, - "222": {"short_name": "FRENCH OVERSEAS DEPARTMENT", "alpha_two_code": ""}, - "223": {"short_name": "GABON", "alpha_two_code": "GA"}, - "224": {"short_name": "LAOS", "alpha_two_code": "LA"}, - "225": {"short_name": "RWANDA", "alpha_two_code": "RW"}, - "226": {"short_name": "CENTRAL AFRICAN REPUBLIC", "alpha_two_code": "CF"}, - "227": {"short_name": "DJIBOUTI", "alpha_two_code": "DJ"}, - "228": {"short_name": "SURINAM", "alpha_two_code": "SR"}, - "229": {"short_name": "BURUNDI", "alpha_two_code": "BI"}, - "230": {"short_name": "HONDURAS", "alpha_two_code": "HN"}, - "231": {"short_name": "GUINEA", "alpha_two_code": "GN"}, - "232": {"short_name": "BENIN", "alpha_two_code": "BJ"}, - "233": {"short_name": "CONGO", "alpha_two_code": "CG"}, - "234": {"short_name": "CHAD", "alpha_two_code": "TD"}, - "239": {"short_name": "MALI", "alpha_two_code": "ML"}, - "240": {"short_name": "MAURITANIA", "alpha_two_code": "MR"}, - "241": {"short_name": "NIGER", "alpha_two_code": "NE"}, - "242": {"short_name": "CZECH REPUBLIC", "alpha_two_code": "CZ"}, - "243": {"short_name": "SLOVAK REPUBLIC", "alpha_two_code": "SK"}, - "244": {"short_name": "TAHITI", "alpha_two_code": "PF"}, - "245": {"short_name": "TRISTAN DA CUHNA", "alpha_two_code": "SH-TA"}, - "246": {"short_name": "BURKINA FASO", "alpha_two_code": "BF"}, - "248": {"short_name": "ABROAD - NOT KNOWN", "alpha_two_code": ""}, - "249": {"short_name": "NOT YET RECORDED", "alpha_two_code": ""}, - "250": {"short_name": "STATELESS", "alpha_two_code": ""}, - "251": {"short_name": "ARUBA", "alpha_two_code": "AW"}, - "252": {"short_name": "BOUVET ISLAND", "alpha_two_code": "BV"}, - "253": {"short_name": "COCOS (KEELING) ISLANDS", "alpha_two_code": "CC"}, - "254": {"short_name": "CHRISTMAS ISLAND", "alpha_two_code": "CX"}, - "255": {"short_name": "WESTERN SAHARA", "alpha_two_code": "EH"}, - "256": {"short_name": "ERITREA", "alpha_two_code": "ER"}, - "257": {"short_name": "MICRONESIA FEDERATION OF", "alpha_two_code": "FM"}, - "258": {"short_name": "FRENCH GUIANA", "alpha_two_code": "GY"}, - "259": {"short_name": "GUADELOUPE", "alpha_two_code": "GP"}, - "260": {"short_name": "SOUTH GEORGIA AND SOUTH SANDWICH ISLAND", "alpha_two_code": "GS"}, - "261": {"short_name": "HEARD ISLAND AND MCDONALD ISLANDS", "alpha_two_code": "HM"}, - "262": {"short_name": "BRITISH INDIAN OCEAN TERRITORIES", "alpha_two_code": "IO"}, - "263": {"short_name": "MARSHALL ISLANDS", "alpha_two_code": "MH"}, - "264": {"short_name": "MYANMAR", "alpha_two_code": "MM"}, - "265": {"short_name": "NORTHERN MARIANA ISLANDS", "alpha_two_code": "MP"}, - "266": {"short_name": "MARTINIQUE", "alpha_two_code": "MQ"}, - "267": {"short_name": "NIUE", "alpha_two_code": "NU"}, - "268": {"short_name": "FRENCH POLYNESIA", "alpha_two_code": "PF"}, - "269": {"short_name": "SAINT PIERRE AND MIQUELON", "alpha_two_code": "PM"}, - "270": {"short_name": "PITCAIRN", "alpha_two_code": "PN"}, - "271": {"short_name": "PALAU", "alpha_two_code": "PW"}, - "272": {"short_name": "REUNION", "alpha_two_code": "RE"}, - "273": {"short_name": "SVALBARD AND JAN MAYEN", "alpha_two_code": "SJ"}, - "274": {"short_name": "FRENCH SOUTHERN TERRITORIES", "alpha_two_code": "FQ"}, - "275": {"short_name": "TOKELAU", "alpha_two_code": "TK"}, - "276": {"short_name": "EAST TIMOR", "alpha_two_code": "TL"}, - "277": {"short_name": "UNITED STATES MINOR OUTLYING ISLANDS", "alpha_two_code": "UM"}, - "278": {"short_name": "WALLIS AND FUTUNA", "alpha_two_code": "WF"}, - "279": {"short_name": "MAYOTTE", "alpha_two_code": "YT"}, - "280": {"short_name": "DEMOCRATIC REPUBLIC OF CONGO", "alpha_two_code": "CD"}, - "281": {"short_name": "CAMBODIA", "alpha_two_code": "KH"}, - "282": {"short_name": "RUSSIA", "alpha_two_code": "RU"}, - "283": {"short_name": "REPUBLIC OF MONTENEGRO", "alpha_two_code": "ME"} -} \ No newline at end of file diff --git a/project/MicroserviceBuild.scala b/project/MicroserviceBuild.scala index 252e013..ebf16d3 100644 --- a/project/MicroserviceBuild.scala +++ b/project/MicroserviceBuild.scala @@ -29,7 +29,7 @@ private object AppDependencies { "org.scalacheck" %% "scalacheck" % "1.12.5", "uk.gov.hmrc" %% "play-hmrc-api" % "1.2.0", "uk.gov.hmrc" %% "domain" % "4.0.0", - "uk.gov.hmrc" %% "play-auth" % "2.2.0-0-g0000000" + "uk.gov.hmrc" %% "play-auth" % "2.2.1" ) val test = Seq( diff --git a/test/it/PlatformIntegrationSpec.scala b/test/it/PlatformIntegrationSpec.scala index 9b2bffc..a5cb0a8 100644 --- a/test/it/PlatformIntegrationSpec.scala +++ b/test/it/PlatformIntegrationSpec.scala @@ -20,9 +20,9 @@ import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.client.WireMock._ import com.github.tomakehurst.wiremock.core.WireMockConfiguration._ -import org.scalatest.{BeforeAndAfterEach, TestData} import org.scalatest.concurrent.ScalaFutures import org.scalatest.mock.MockitoSugar +import org.scalatest.{BeforeAndAfterEach, TestData} import org.scalatestplus.play.OneAppPerTest import play.api.Mode import play.api.inject.guice.GuiceApplicationBuilder diff --git a/test/it/UserInfoServiceSpec.scala b/test/it/UserInfoServiceSpec.scala index 2df1ab3..b6dd952 100644 --- a/test/it/UserInfoServiceSpec.scala +++ b/test/it/UserInfoServiceSpec.scala @@ -207,7 +207,6 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { authStub.willReturnEnrolmentsWith() And("The auth will authorise and DES contains user information for the NINO") -// authStub.willAuthorise(DesUserInfo(ItmpName(None, None, None), None, ItmpAddress(None, None, None, None, None, None, None, None))) authStub.willNotFindUser() When("We request the user information") @@ -324,9 +323,6 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { thirdPartyDelegatedAuthorityStub.willReturnScopesForAuthBearerToken(authBearerToken, Set("openid:government_gateway", "openid:hmrc_enrolments", "address")) -// And("All upstream services excluding user-info have valid reponse") -// authStub.willAuthorise(Some(desUserInfo)) - And("Auth returns unauthorized") authStub.willReturnAuthorityWith(503) authStub.willReturnEnrolmentsWith(503) diff --git a/test/it/stubs/AuthStub.scala b/test/it/stubs/AuthStub.scala index 0cfbf77..593aeb0 100644 --- a/test/it/stubs/AuthStub.scala +++ b/test/it/stubs/AuthStub.scala @@ -18,7 +18,6 @@ package it.stubs import com.github.tomakehurst.wiremock.client.WireMock._ import it.{MockHost, Stub} -import play.api.libs.json.Json.JsValueWrapper import play.api.libs.json._ import uk.gov.hmrc.auth.core.authorise.{AffinityGroup, CredentialRole} import uk.gov.hmrc.auth.core.retrieve._ @@ -26,7 +25,6 @@ import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.openidconnect.userinfo.domain.DesUserInfo import uk.gov.hmrc.play.auth.microservice.connectors.ConfidenceLevel import uk.gov.hmrc.play.controllers.RestFormats.localDateFormats -import uk.gov.hmrc.auth.core.authorise.AffinityGroup.jsonFormat object AuthStub extends Stub { override val stub: MockHost = new MockHost(22221) @@ -35,9 +33,6 @@ object AuthStub extends Stub { implicit class JsOptAppendable(jsObject: JsObject) { def appendOptional(key: String, value: Option[JsValue]): JsObject = value.map(js => jsObject + (key -> js)) .getOrElse(jsObject) -// -// def appendOptional[A: Writes](key: String, value: Option[A]): JsObject = value.map(js => jsObject + (key -> js)) -// .getOrElse(jsObject) } def willReturnAuthorityWith(confidenceLevel: ConfidenceLevel, nino: Nino): Unit = { @@ -79,24 +74,6 @@ object AuthStub extends Stub { val jsonAgent: Option[JsValue] = agentInformation.map(Json.toJson(_)) val jsonCredentials: Option[JsValue] = credentials.map(Json.toJson(_)) val jsonName : Option[JsValue] = name.map(Json.toJson(_)) - val jsonEmail : Option[JsValue] = email.map(Json.toJson(_)) -// val jsonAddress: Option[JsValue] = desUserInfo.map(_.address).map(address => Json.parse( -// s"""{ -// | "line1": ${optionalElement(address.line1)}, -// | "line2": ${optionalElement(address.line2)}, -// | "line3": ${optionalElement(address.line3)}, -// | "line4": ${optionalElement(address.line4)}, -// | "line5": ${optionalElement(address.line5)}, -// | "postCode": ${optionalElement(address.postCode)}, -// | "countryName": ${optionalElement(address.countryName)}, -// | "countryCode": ${optionalElement(address.countryCode)} -// | }""".stripMargin)) -// val jsonName: Option[JsValue] = desUserInfo.map(_.name).map(name => Json.parse( -// s"""{ -// | "givenName": ${optionalElement(name.givenName)}, -// | "middleName": ${optionalElement(name.middleName)}, -// | "familyName": ${optionalElement(name.familyName)} -// |}""".stripMargin)) val jsonDob = desUserInfo.flatMap(_.dateOfBirth) val response = Json.obj() diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala index 7895e5f..f8c54a4 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/ErrorResponseSpec.scala @@ -16,9 +16,9 @@ package unit.uk.gov.hmrc.openidconnect.userinfo.controllers -import uk.gov.hmrc.openidconnect.userinfo.controllers.ErrorAcceptHeaderInvalid import org.scalatest.Matchers import play.api.libs.json.Json +import uk.gov.hmrc.openidconnect.userinfo.controllers.ErrorAcceptHeaderInvalid import uk.gov.hmrc.play.test.UnitSpec class ErrorResponseSpec extends UnitSpec with Matchers{ diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala index 90bda6d..d095cbf 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGeneratorSpec.scala @@ -16,12 +16,12 @@ package unit.uk.gov.hmrc.openidconnect.userinfo.data -import uk.gov.hmrc.openidconnect.userinfo.data.UserInfoGenerator -import uk.gov.hmrc.openidconnect.userinfo.domain.UserInfo import org.joda.time.LocalDate import org.scalatest.BeforeAndAfterEach import org.scalatest.prop.PropertyChecks import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} +import uk.gov.hmrc.openidconnect.userinfo.data.UserInfoGenerator +import uk.gov.hmrc.openidconnect.userinfo.domain.UserInfo import uk.gov.hmrc.play.test.UnitSpec class UserInfoGeneratorSpec extends UnitSpec with PropertyChecks with BeforeAndAfterEach { diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala index eafc08a..1a03e72 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala @@ -17,7 +17,6 @@ package unit.uk.gov.hmrc.openidconnect.userinfo.services import org.joda.time.LocalDate -import org.mockito.BDDMockito.given import org.scalatest.BeforeAndAfterEach import org.scalatest.mock.MockitoSugar import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName} From d465ac8df0197060ecdaf6dc337ab30ac05d80f8 Mon Sep 17 00:00:00 2001 From: Radoslaw Busz Date: Fri, 8 Sep 2017 14:24:39 +0100 Subject: [PATCH 2/4] PE-3167 PE-3216 - Add mdtp scope and unread_message_count field --- .../userinfo/connectors/AuthConnector.scala | 56 ++++++++++--------- .../userinfo/data/UserInfoGenerator.scala | 11 +++- .../userinfo/domain/Authority.scala | 3 +- .../domain/GovernmentGatewayDetails.scala | 3 +- .../userinfo/domain/UserDetails.scala | 35 ++++++------ .../userinfo/domain/UserInfo.scala | 7 ++- .../userinfo/domain/package.scala | 5 +- .../userinfo/services/UserInfoService.scala | 6 +- .../services/UserInfoTransformer.scala | 15 +++-- project/MicroserviceBuild.scala | 2 +- .../1.0/examples/get-user-info-example-1.json | 7 ++- public/api/conf/1.0/schemas/userinfo.json | 21 +++++++ test/it/UserInfoServiceSpec.scala | 45 ++++++++++----- test/it/stubs/AuthStub.scala | 11 ++-- .../connectors/AuthConnectorSpec.scala | 2 +- .../controllers/UserInfoControllerSpec.scala | 2 +- .../userinfo/services/AuthServiceSpec.scala | 2 +- .../services/UserInfoServiceSpec.scala | 16 +++--- .../services/UserInfoTransformerSpec.scala | 44 ++++++++------- 19 files changed, 184 insertions(+), 109 deletions(-) diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala b/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala index 8cd3bab..932309e 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnector.scala @@ -48,47 +48,49 @@ trait AuthConnector extends uk.gov.hmrc.play.auth.microservice.connectors.AuthCo } } - def fetchUserDetails(auth: Authority)(implicit hc: HeaderCarrier): Future[Option[UserDetails]] = { - authorised().retrieve(Retrievals.allUserDetails) { + def fetchUserDetails()(implicit hc: HeaderCarrier): Future[Option[UserDetails]] = { + authorised().retrieve(Retrievals.allUserDetails and Retrievals.mdtpInformation and Retrievals.gatewayInformation) { case credentials ~ name ~ birthDate ~ postCode ~ email ~ affinityGroup ~ agentCode ~ agentInformation ~ - credentialRole ~ description ~ groupId => + credentialRole ~ description ~ groupId ~ mdtp ~ gatewayInformation => Future.successful(Some(UserDetails(authProviderId = Some(credentials.providerId), authProviderType = Some(credentials.providerType), name = name.name, lastName = name.lastName, dateOfBirth = birthDate, postCode = postCode, email = email, affinityGroup = affinityGroup.map(_.toString()), agentCode = agentCode, agentFriendlyName = agentInformation.agentFriendlyName, credentialRole = credentialRole.map(_.toString), - description = description, groupIdentifier = groupId, agentId = agentInformation.agentId))) + description = description, groupIdentifier = groupId, agentId = agentInformation.agentId, + gatewayInformation = gatewayInformation, mdtpInformation = mdtp))) case _ => Future.successful(None) }.recover { case e: NotFoundException => None } + } - def fetchDesUserInfo(authority: Authority)(implicit hc: HeaderCarrier): Future[Option[DesUserInfo]] = { - val nothing = Future.successful(None) - if (authority.nino.isDefined) - authorised().retrieve(Retrievals.allItmpUserDetails) { - case name ~ dateOfBirth ~ address => - Future.successful(Some(DesUserInfo(name, dateOfBirth, address))) - case _ => nothing - }.recoverWith { - case ex: NotFoundException => nothing - } - else nothing - } - - def fetchAuthority()(implicit headerCarrier: HeaderCarrier): Future[Option[Authority]] = { - http.GET(s"$authBaseUrl/auth/authority") map { response => - response.json.asOpt[Authority] + def fetchDesUserInfo(auth: Authority)(implicit hc: HeaderCarrier): Future[Option[DesUserInfo]] = { + val nothing = Future.successful(None) + if (auth.nino.isDefined) + authorised().retrieve(Retrievals.allItmpUserDetails) { + case name ~ dateOfBirth ~ address => + Future.successful(Some(DesUserInfo(name, dateOfBirth, address))) + case _ => nothing + }.recoverWith { + case ex: NotFoundException => nothing } + else nothing + } + + def fetchAuthority()(implicit headerCarrier: HeaderCarrier): Future[Option[Authority]] = { + http.GET(s"$authBaseUrl/auth/authority") map { response => + response.json.asOpt[Authority] } } +} - object AuthConnector extends AuthConnector with ServicesConfig { - override lazy val authBaseUrl = baseUrl("auth") - lazy val http = WSHttp +object AuthConnector extends AuthConnector with ServicesConfig { + override lazy val authBaseUrl = baseUrl("auth") + lazy val http = WSHttp - override def authConnector = new PlayAuthConnector { - override val serviceUrl = baseUrl("auth") + override def authConnector = new PlayAuthConnector { + override val serviceUrl = baseUrl("auth") - override def http = WSHttp - } + override def http = WSHttp } +} \ No newline at end of file diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala b/app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala index c3404f6..eb5d777 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/data/UserInfoGenerator.scala @@ -18,13 +18,16 @@ package uk.gov.hmrc.openidconnect.userinfo.data import org.joda.time._ import org.scalacheck.Gen +import uk.gov.hmrc.auth.core.retrieve.MdtpInformation import uk.gov.hmrc.openidconnect.userinfo.config.UserInfoFeatureSwitches -import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, Enrolment, EnrolmentIdentifier, GovernmentGatewayDetails, UserInfo} +import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, Enrolment, EnrolmentIdentifier, GovernmentGatewayDetails, Mdtp, UserInfo} trait UserInfoGenerator { val firstNames = List(Some("Roland"), Some("Eddie"), Some("Susanna"), Some("Jake"), Some("Oy"), Some("Cuthbert"), Some("Alain"), Some("Jamie"), Some("Thomas"), Some("Susan"), Some("Randall"), None) val middleNames = List(Some("De"), Some("Donald"), Some("Billy"), Some("E"), Some("Alex"), Some("Abel"), None, None, None, None, None, None) val lastNames = List(Some("Deschain"), Some("Dean"), Some("Dean"), Some("Chambers"), Some("Bumbler"), Some("Allgood"), Some("Johns"), Some("Curry"), Some("Whitman"), Some("Delgado"), Some("Flagg"), Some("Bowen"), None) + val deviceId = "device-id-abc" + val sessionId = "session-id-abcd" val fullAddress = Some(Address( """221B Baker Street @@ -52,7 +55,8 @@ trait UserInfoGenerator { val enrolments = Seq(Enrolment("IR-SA", List(EnrolmentIdentifier("UTR", "174371121")))) val government_gateway: GovernmentGatewayDetails = GovernmentGatewayDetails(Some("32131"),Some(Seq("User")),Some("affinityGroup"), - Some("agent-code-12345"), Some("agent-id-12345"), Some("agent-friendly-name-12345"), Some("gateway-token-val")) + Some("agent-code-12345"), Some("agent-id-12345"), Some("agent-friendly-name-12345"), Some("gateway-token-val"), Some(10)) + val mdtp = Mdtp(deviceId, sessionId) private lazy val ninoPrefixes = "ABCEGHJKLMNPRSTWXYZ" @@ -98,7 +102,8 @@ trait UserInfoGenerator { middleName <- middleNameGen dob <- dateOfBirth nino <- formattedNino - } yield UserInfo(name, lastName, middleName, address, email(name, lastName), Some(dob), Some(nino), Some(enrolments), Some(government_gateway)) + } yield UserInfo(name, lastName, middleName, address, email(name, lastName), Some(dob), Some(nino), Some(enrolments), + Some(government_gateway), Some(mdtp)) } object UserInfoGenerator extends UserInfoGenerator diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala index efbcb87..c2cfa0b 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/Authority.scala @@ -22,5 +22,4 @@ case class Authority(credentialStrength: Option[String] = None, userDetailsLink: Option[String] = None, enrolments: Option[String] = None, affinityGroup: Option[String] = None, - credId: Option[String] = None, - gatewayToken: Option[String] = None) + credId: Option[String] = None) \ No newline at end of file diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala index 3c0c39e..8a59ffc 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/GovernmentGatewayDetails.scala @@ -23,5 +23,6 @@ case class GovernmentGatewayDetails( agent_code: Option[String], agent_id: Option[String], agent_friendly_name: Option[String], - gateway_token: Option[String] + gateway_token: Option[String], + unread_message_count: Option[Int] ) diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala index aef7393..7493cbb 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserDetails.scala @@ -17,20 +17,23 @@ package uk.gov.hmrc.openidconnect.userinfo.domain import org.joda.time.LocalDate +import uk.gov.hmrc.auth.core.retrieve.{GatewayInformation, MdtpInformation} -case class UserDetails ( - authProviderId: Option[String] = None, - authProviderType: Option[String] = None, - name: Option[String] = None, - lastName: Option[String] = None, - dateOfBirth: Option[LocalDate] = None, - postCode: Option[String] = None, - email: Option[String] = None, - affinityGroup: Option[String] = None, - agentCode: Option[String] = None, - agentFriendlyName: Option[String] = None, - credentialRole: Option[String] = None, - description: Option[String] = None, - groupIdentifier: Option[String] = None, - agentId: Option[String] = None - ) +case class UserDetails( + authProviderId: Option[String] = None, + authProviderType: Option[String] = None, + name: Option[String] = None, + lastName: Option[String] = None, + dateOfBirth: Option[LocalDate] = None, + postCode: Option[String] = None, + email: Option[String] = None, + affinityGroup: Option[String] = None, + agentCode: Option[String] = None, + agentFriendlyName: Option[String] = None, + credentialRole: Option[String] = None, + description: Option[String] = None, + groupIdentifier: Option[String] = None, + agentId: Option[String] = None, + gatewayInformation: Option[GatewayInformation], + mdtpInformation: Option[MdtpInformation] + ) diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala index c1d7725..05688fa 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/UserInfo.scala @@ -17,13 +17,15 @@ package uk.gov.hmrc.openidconnect.userinfo.domain import org.joda.time.LocalDate -import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName} +import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName, MdtpInformation} case class Address(formatted: String, postal_code: Option[String], country: Option[String], country_code: Option[String]) +case class Mdtp(device_id: String, session_id: String) + case class UserInfo(given_name: Option[String], family_name: Option[String], middle_name: Option[String], @@ -32,7 +34,8 @@ case class UserInfo(given_name: Option[String], birthdate: Option[LocalDate], uk_gov_nino: Option[String], hmrc_enrolments: Option[Seq[Enrolment]], - government_gateway: Option[GovernmentGatewayDetails]) + government_gateway: Option[GovernmentGatewayDetails], + mdtp: Option[Mdtp]) case class UserInformation(profile: Option[UserProfile], address: Option[Address], diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala b/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala index f86fb6d..5c6b117 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/domain/package.scala @@ -17,7 +17,7 @@ package uk.gov.hmrc.openidconnect.userinfo import play.api.libs.json._ -import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName} +import uk.gov.hmrc.auth.core.retrieve.{GatewayInformation, ItmpAddress, ItmpName, MdtpInformation} import uk.gov.hmrc.play.http.Token package object domain { @@ -30,7 +30,10 @@ package object domain { implicit val enrloment = Json.format[Enrolment] implicit val token = Json.format[Token] + implicit val gatewayInformationFmt: Format[GatewayInformation] = Json.format[GatewayInformation] + implicit val mdtpInformationFmt: Format[MdtpInformation] = Json.format[MdtpInformation] implicit val userDetails = Json.format[UserDetails] + implicit val mdtp = Json.format[Mdtp] implicit val governmentGatewayDetails = Json.format[GovernmentGatewayDetails] implicit val dateReads = Reads.jodaDateReads("yyyy-MM-dd") diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala b/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala index d40d536..0449b49 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoService.scala @@ -53,7 +53,7 @@ trait LiveUserInfoService extends UserInfoService { else Future.successful(None) } - val scopesForAuthority = Set("openid:government_gateway", "email", "profile", "address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments") + val scopesForAuthority = Set("openid:government_gateway", "email", "profile", "address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:mdtp") val maybeAuthority = getMaybeForScopes(scopesForAuthority, scopes, authConnector.fetchAuthority) val scopesForDes = Set("profile", "address") @@ -64,9 +64,9 @@ trait LiveUserInfoService extends UserInfoService { else Future.successful(None) } - val scopesForUserDetails = Set("openid:government_gateway", "email") + val scopesForUserDetails = Set("openid:government_gateway", "email", "openid:mdtp") val maybeUserDetails = maybeAuthority flatMap { authority => - getMaybeByParamForScopes[Authority, UserDetails](scopesForUserDetails, scopes, authority.getOrElse(Authority()), authConnector.fetchUserDetails) + getMaybeByParamForScopes[Authority, UserDetails](scopesForUserDetails, scopes, authority.getOrElse(Authority()), _ => authConnector.fetchUserDetails) } def maybeEnrolments = maybeAuthority flatMap { authority => diff --git a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala b/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala index e435cc8..986a30c 100644 --- a/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala +++ b/app/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformer.scala @@ -19,7 +19,7 @@ package uk.gov.hmrc.openidconnect.userinfo.services import org.joda.time.LocalDate import uk.gov.hmrc.auth.core.retrieve.ItmpAddress import uk.gov.hmrc.openidconnect.userinfo.config.UserInfoFeatureSwitches -import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, Authority, DesUserInfo, Enrolment, GovernmentGatewayDetails, UserDetails, UserInfo} +import uk.gov.hmrc.openidconnect.userinfo.domain.{Address, Authority, DesUserInfo, Enrolment, GovernmentGatewayDetails, Mdtp, UserDetails, UserInfo} trait UserInfoTransformer { @@ -44,6 +44,9 @@ trait UserInfoTransformer { val email = if (scopes.contains("email")) userDetails flatMap {_.email} else None + val mdtp = if (scopes.contains("openid:mdtp")) userDetails.flatMap(_.mdtpInformation.map(m => Mdtp(m.deviceId, m.sessionId))) else None + + UserInfo(profile.flatMap(_.firstName), profile.flatMap(_.familyName), profile.flatMap(_.middleName), @@ -52,7 +55,8 @@ trait UserInfoTransformer { profile.flatMap(_.birthDate), identifier, userEnrolments, - ggInfo) + ggInfo, + mdtp) } private def formattedAddress(desAddress: ItmpAddress) = { @@ -69,10 +73,13 @@ trait UserInfoTransformer { val agentCode = userDetails flatMap { _.agentCode} val agentFriendlyName = userDetails flatMap { _.agentFriendlyName} val agentId = userDetails flatMap { _.agentId} - val gatewayToken = authority flatMap { _.gatewayToken } + val gatewayInformation = userDetails flatMap { _.gatewayInformation } + val mdtp = userDetails flatMap { _.mdtpInformation } Some(GovernmentGatewayDetails(user_id = credId, roles = credentialRoles, affinity_group = affinityGroup, - agent_code = agentCode, agent_id = agentId, agent_friendly_name = agentFriendlyName, gateway_token = gatewayToken)) + agent_code = agentCode, agent_id = agentId, agent_friendly_name = agentFriendlyName, + gateway_token = gatewayInformation.flatMap(_.gatewayToken), + unread_message_count = gatewayInformation.flatMap(_.unreadMessageCount))) } private case class UserProfile(firstName: Option[String], familyName: Option[String], middleName: Option[String], birthDate: Option[LocalDate]) diff --git a/project/MicroserviceBuild.scala b/project/MicroserviceBuild.scala index ebf16d3..e134670 100644 --- a/project/MicroserviceBuild.scala +++ b/project/MicroserviceBuild.scala @@ -29,7 +29,7 @@ private object AppDependencies { "org.scalacheck" %% "scalacheck" % "1.12.5", "uk.gov.hmrc" %% "play-hmrc-api" % "1.2.0", "uk.gov.hmrc" %% "domain" % "4.0.0", - "uk.gov.hmrc" %% "play-auth" % "2.2.1" + "uk.gov.hmrc" %% "play-auth" % "2.3.0-1-gf54f401" ) val test = Seq( diff --git a/public/api/conf/1.0/examples/get-user-info-example-1.json b/public/api/conf/1.0/examples/get-user-info-example-1.json index dd1da39..b94a859 100644 --- a/public/api/conf/1.0/examples/get-user-info-example-1.json +++ b/public/api/conf/1.0/examples/get-user-info-example-1.json @@ -31,6 +31,11 @@ "agent_code": "123456-abc", "agent_friendly_name": "AC Accounting", "agent_id": "AC", - "gateway_token": "token-value-1234" + "gateway_token": "token-value-1234", + "unread_message_count": 0 + }, + "mdtp": { + "device_id": "device_id-12345", + "session_id": "session_id_123455" } } diff --git a/public/api/conf/1.0/schemas/userinfo.json b/public/api/conf/1.0/schemas/userinfo.json index acf1ae8..282b327 100644 --- a/public/api/conf/1.0/schemas/userinfo.json +++ b/public/api/conf/1.0/schemas/userinfo.json @@ -114,6 +114,22 @@ ] } }, + "mdtp": { + "type": "object", + "description": "Mdtp information based on government gateway input", + "properties": { + "device_id": { + "type": "string", + "description": "Device id", + "example": "3012345" + }, + "session_id": { + "type": "string", + "description": "Session id", + "example": "2012345" + } + } + }, "government_gateway": { "type": "object", "description": "Legacy properties based on government gateway input.", @@ -155,6 +171,11 @@ "type": "string", "description": "Government gateway token", "example": "123456789" + }, + "unread_message_count": { + "type": "integer", + "description": "Unread message count", + "example": 12345 } }, "additionalProperties": false diff --git a/test/it/UserInfoServiceSpec.scala b/test/it/UserInfoServiceSpec.scala index b6dd952..ec96b6e 100644 --- a/test/it/UserInfoServiceSpec.scala +++ b/test/it/UserInfoServiceSpec.scala @@ -50,8 +50,13 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { val desUserInfo = DesUserInfo(ItmpName(Some("John"), Some("A"), Some("Smith")), Some(LocalDate.parse("1980-01-01")), ItmpAddress(Some("1 Station Road"), Some("Town Centre"), Some("London"), Some("England"), Some("UK"), Some("NW1 6XE"), Some("GREAT BRITAIN"), Some("GB"))) val enrolments = Seq(Enrolment("IR-SA", List(EnrolmentIdentifier("UTR", "174371121")))) + val deviceId = "device-id-12345" + val sessionId = "session-id-12345" + val mdtp = Mdtp(deviceId, sessionId) + val authMdtp = MdtpInformation(deviceId, sessionId) + val gatewayInformation = GatewayInformation(Some("gateway-token-qwert"), Some(10)) val government_gateway: GovernmentGatewayDetails = GovernmentGatewayDetails(Some("1304372065861347"),Some(Seq("Admin")) - ,Some("Individual"), Some("AC-12345"), Some("ACC"), Some("AC Accounting"), Some("gateway-token-qwert")) + ,Some("Individual"), Some("AC-12345"), Some("ACC"), Some("AC Accounting"), Some("gateway-token-qwert"), Some(10)) val email = "my-email@abc.uk" val userInfo = UserInfo( @@ -63,7 +68,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Some(LocalDate.parse("1980-01-01")), Some("AB123456A"), Some(enrolments), - Some(government_gateway)) + Some(government_gateway), + Some(mdtp)) val desUserInfoWithoutFirstName = DesUserInfo(ItmpName(None, Some("A"), Some("Smith")), Some(LocalDate.parse("1980-01-01")), ItmpAddress(Some("1 Station Road"), Some("Town Centre"), Some("London"), Some("England"), Some("UK"), Some("NW1 6XE"), Some("GREAT BRITAIN"), Some("GB"))) val userInfoWithoutFirstName = UserInfo( @@ -75,7 +81,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Some(LocalDate.parse("1980-01-01")), Some("AB123456A"), Some(enrolments), - Some(government_gateway) + Some(government_gateway), + Some(mdtp) ) val desUserInfoWithoutFamilyName = DesUserInfo(ItmpName(Some("John"), Some("A"), None), Some(LocalDate.parse("1980-01-01")), ItmpAddress(Some("1 Station Road"), Some("Town Centre"), Some("London"), Some("England"), Some("UK"), Some("NW1 6XE"), Some("GREAT BRITAIN"), Some("GB"))) @@ -88,7 +95,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Some(LocalDate.parse("1980-01-01")), Some("AB123456A"), Some(enrolments), - Some(government_gateway)) + Some(government_gateway), + Some(mdtp)) val desUserInfoWithPartialAddress = DesUserInfo(ItmpName(Some("John"), Some("A"), Some("Smith")), Some(LocalDate.parse("1980-01-01")), ItmpAddress(Some("1 Station Road"), None, Some("Lancaster"), Some("England"), Some("UK"), Some("NW1 6XE"), Some("GREAT BRITAIN"), Some("GB"))) val userInfoWithPartialAddress = UserInfo( @@ -100,16 +108,18 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Some(LocalDate.parse("1980-01-01")), Some("AB123456A"), None, - Some(government_gateway)) + Some(government_gateway), + Some(mdtp)) feature("fetch user information") { scenario("fetch user profile") { - Given("A Auth token with 'openid', 'profile', 'address', 'openid:gov-uk-identifiers', 'openid:hmrc_enrolments', " + + Given("A Auth token with 'openid', 'profile', 'address', 'openid:gov-uk-identifiers', 'openid:hmrc_enrolments', 'openid:mdtp'," + "'email' and 'openid:government_gateway' scopes") thirdPartyDelegatedAuthorityStub.willReturnScopesForAuthBearerToken(authBearerToken, - Set("openid", "profile", "address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "agentInformation")) + Set("openid", "profile", "address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", + "openid:government_gateway", "email", "agentInformation", "openid:mdtp")) And("The Auth token has a confidence level above 200 and a NINO") authStub.willReturnAuthorityWith(ConfidenceLevel.L200, Nino(nino)) @@ -119,7 +129,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { And("The auth will authorise DES contains user information for the NINO") authStub.willAuthorise(Some(desUserInfo), Some(AgentInformation(government_gateway.agent_id, government_gateway.agent_code, government_gateway.agent_friendly_name)), Some(Credentials("", "")), - Some(uk.gov.hmrc.auth.core.retrieve.Name(None, None)), Some(Email(email)), Some(AffinityGroup.Individual), Some(CredentialRole.Admin)) + Some(uk.gov.hmrc.auth.core.retrieve.Name(None, None)), Some(Email(email)), Some(AffinityGroup.Individual), + Some(CredentialRole.Admin), Some(authMdtp), Some(gatewayInformation)) When("We request the user information") val result = Http(s"$serviceUrl") @@ -168,21 +179,22 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Then("The user information is returned") result.code shouldBe 200 - Json.parse(result.body) shouldBe Json.toJson(userInfoWithoutFamilyName.copy(government_gateway = None, email = None)) + Json.parse(result.body) shouldBe Json.toJson(userInfoWithoutFamilyName.copy(government_gateway = None, email = None, + mdtp = None)) } scenario("fetch user data without enrolments when there are no enrolments") { Given("A Auth token with 'openid', 'profile', 'address', 'openid:gov-uk-identifiers', 'email', 'openid:government_gateway' and 'openid:hmrc_enrolments' scopes") thirdPartyDelegatedAuthorityStub.willReturnScopesForAuthBearerToken(authBearerToken, - Set("openid", "profile", "address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email")) + Set("openid", "profile", "address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp")) And("The Auth token has a confidence level above 200 and a NINO") authStub.willReturnAuthorityWith(ConfidenceLevel.L200, Nino(nino)) And("The auth will authorise and DES contains user information for the NINO") authStub.willAuthorise(Some(desUserInfo), Some(AgentInformation(government_gateway.agent_id, government_gateway.agent_code, government_gateway.agent_friendly_name)), Some(Credentials("", "")), - Some(uk.gov.hmrc.auth.core.retrieve.Name(None, None)), Some(Email(email)), Some(AffinityGroup.Individual), Some(CredentialRole.Admin)) + Some(uk.gov.hmrc.auth.core.retrieve.Name(None, None)), Some(Email(email)), Some(AffinityGroup.Individual), Some(CredentialRole.Admin), Some(authMdtp), Some(gatewayInformation)) When("We request the user information") val result = Http(s"$serviceUrl") @@ -216,7 +228,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Then("The user information is returned") result.code shouldBe 200 - val userWithNinoAndEnrolmentsOnly = userInfo.copy(given_name = None, family_name = None, middle_name = None, address = None, birthdate = None, government_gateway = None, email = None) + val userWithNinoAndEnrolmentsOnly = userInfo.copy(given_name = None, family_name = None, middle_name = None, + address = None, birthdate = None, government_gateway = None, email = None, mdtp = None) Json.parse(result.body) shouldBe Json.toJson(userWithNinoAndEnrolmentsOnly) } @@ -239,7 +252,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Then("The user information is returned") result.code shouldBe 200 - val userWithEnrolmentsOnly = userInfo.copy(given_name = None, family_name = None, middle_name = None, address = None, birthdate = None, uk_gov_nino = None, government_gateway = None, email = None) + val userWithEnrolmentsOnly = userInfo.copy(given_name = None, family_name = None, middle_name = None, + address = None, birthdate = None, uk_gov_nino = None, government_gateway = None, email = None, mdtp = None) Json.parse(result.body) shouldBe Json.toJson(userWithEnrolmentsOnly) } @@ -257,7 +271,7 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { And("The auth will authorise DES contains user information for the NINO") authStub.willAuthorise(Some(desUserInfo), Some(AgentInformation(government_gateway.agent_id, government_gateway.agent_code, government_gateway.agent_friendly_name)), Some(Credentials("", "")), - Some(uk.gov.hmrc.auth.core.retrieve.Name(None, None)), Some(Email(email)), Some(AffinityGroup.Individual), Some(CredentialRole.Admin)) + Some(uk.gov.hmrc.auth.core.retrieve.Name(None, None)), Some(Email(email)), Some(AffinityGroup.Individual), Some(CredentialRole.Admin), None, gatewayInformation = Some(gatewayInformation)) When("We request the user information") val result = Http(s"$serviceUrl") @@ -266,7 +280,8 @@ class UserInfoServiceSpec extends BaseFeatureSpec with BeforeAndAfterAll { Then("The user information is returned") result.code shouldBe 200 - val userWithGovernmentDetailsOnly = userInfo.copy(given_name = None, family_name = None, middle_name = None, address = None, birthdate = None, uk_gov_nino = None, hmrc_enrolments = None, email = None) + val userWithGovernmentDetailsOnly = userInfo.copy(given_name = None, family_name = None, middle_name = None, + address = None, birthdate = None, uk_gov_nino = None, hmrc_enrolments = None, email = None, mdtp = None) Json.parse(result.body) shouldBe Json.toJson(userWithGovernmentDetailsOnly) } diff --git a/test/it/stubs/AuthStub.scala b/test/it/stubs/AuthStub.scala index 593aeb0..73e3059 100644 --- a/test/it/stubs/AuthStub.scala +++ b/test/it/stubs/AuthStub.scala @@ -25,6 +25,7 @@ import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.openidconnect.userinfo.domain.DesUserInfo import uk.gov.hmrc.play.auth.microservice.connectors.ConfidenceLevel import uk.gov.hmrc.play.controllers.RestFormats.localDateFormats +import uk.gov.hmrc.openidconnect.userinfo.domain._ object AuthStub extends Stub { override val stub: MockHost = new MockHost(22221) @@ -62,19 +63,19 @@ object AuthStub extends Stub { def willAuthorise(desUserInfo: Option[DesUserInfo] = None, agentInformation: Option[AgentInformation] = None, credentials: Option[Credentials] = None, name: Option[Name] = None, email: Option[Email] = None, - affinityGroup: Option[AffinityGroup] = None, role: Option[CredentialRole] = None): Unit = { - implicit val addressWrites = Json.writes[ItmpAddress] - implicit val itmpNameWrites = Json.writes[ItmpName] + affinityGroup: Option[AffinityGroup] = None, role: Option[CredentialRole] = None, + mdtp: Option[MdtpInformation] = None, gatewayInformation: Option[GatewayInformation] = None): Unit = { implicit val agentWrites = Json.writes[AgentInformation] implicit val credentialWrites = Json.writes[Credentials] implicit val nameWrites = Json.writes[Name] - implicit val emailWrites = Json.writes[Email] val jsonAddress: Option[JsValue] = desUserInfo.map(d => Json.toJson(d.address)) val jsonItmpName: Option[JsValue] = desUserInfo.map(d => Json.toJson(d.name)) val jsonAgent: Option[JsValue] = agentInformation.map(Json.toJson(_)) val jsonCredentials: Option[JsValue] = credentials.map(Json.toJson(_)) val jsonName : Option[JsValue] = name.map(Json.toJson(_)) val jsonDob = desUserInfo.flatMap(_.dateOfBirth) + val jsonMdtp: Option[JsValue] = mdtp.map(Json.toJson(_)) + val jsonGatewayInformation: Option[JsValue] = gatewayInformation.map(Json.toJson(_)) val response = Json.obj() .appendOptional("itmpName", jsonItmpName) @@ -87,6 +88,8 @@ object AuthStub extends Stub { .appendOptional("affinityGroup", affinityGroup.map(ag => AffinityGroup.jsonFormat.writes(ag))) .appendOptional("credentialRole", role.map(r => CredentialRole.jsonFormat.writes(r))) .appendOptional("agentCode", agentInformation.flatMap(a => a.agentCode.map(JsString))) + .appendOptional("mdtpInformation", jsonMdtp) + .appendOptional("gatewayInformation", jsonGatewayInformation) stub.mock.register(post(urlPathEqualTo(s"/auth/authorise")) .willReturn(aResponse() diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnectorSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnectorSpec.scala index e38b6ce..6a915a3 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnectorSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/connectors/AuthConnectorSpec.scala @@ -30,7 +30,7 @@ class AuthConnectorSpec extends WireMockSugar { "fetchEnrolments" should { val authority = Authority(Some("weak"), Some(200), Some("AA111111A"), Some("/uri/to/userDetails"), - Some("/uri/to/enrolments"), Some("Individual"), Some("1304372065861347")) + Some("/uri/to/enrolments"), Some("Individual")) "return the authority enrolments" in new TestAuthConnector(wiremockBaseUrl) { given().get(urlPathEqualTo("/uri/to/enrolments")).returns(enrolmentsJson()) fetchEnrolments(authority).futureValue shouldBe Some(Seq(Enrolment("IR-SA", List(EnrolmentIdentifier("UTR", "174371121"))))) diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala index e0adad1..2bfd6ae 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/controllers/UserInfoControllerSpec.scala @@ -43,7 +43,7 @@ class UserInfoControllerSpec extends UnitSpec with MockitoSugar with ScalaFuture Some("AR778351B"), Some(Seq(Enrolment("IR-SA", List(EnrolmentIdentifier("UTR", "174371121"))))), Some(GovernmentGatewayDetails(Some("32131"),Some(Seq("User")),Some("affinityGroup"), Some("agent-code-12345"), - Some("agent-id-12345"), Some("agent-friendly-name"), None))) + Some("agent-id-12345"), Some("agent-friendly-name"), None, None)), None) trait Setup extends MicroserviceFilterSupport { val mockLiveUserInfoService = mock[LiveUserInfoService] diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/AuthServiceSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/AuthServiceSpec.scala index dcff038..080477e 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/AuthServiceSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/AuthServiceSpec.scala @@ -41,7 +41,7 @@ class AuthServiceSpec extends UnitSpec with ScalaFutures with MockitoSugar { "isAuthorised" should { val authority = Authority(Some("weak"), Some(200), Some("AA111111A"), Some("/uri/to/userDetails"), - Some("/uri/to/enrolments"), Some("Individual"), Some("1304372065861347")) + Some("/uri/to/enrolments"), Some("Individual")) "return true if confidenceLevel is 200" in new Setup { when(authService.authConnector.fetchAuthority()(any())).thenReturn(Future(Option(authority))) diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala index 2507e57..8a8e511 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoServiceSpec.scala @@ -21,7 +21,7 @@ import org.mockito.Matchers.any import org.mockito.Mockito.{never, verify} import org.scalatest.concurrent.ScalaFutures import org.scalatest.mock.MockitoSugar -import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName} +import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName, MdtpInformation} import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.openidconnect.userinfo.connectors.{AuthConnector, ThirdPartyDelegatedAuthorityConnector} import uk.gov.hmrc.openidconnect.userinfo.data.UserInfoGenerator @@ -41,17 +41,19 @@ class UserInfoServiceSpec extends UnitSpec with MockitoSugar with ScalaFutures { val desUserInfo = DesUserInfo(ItmpName(Some("John"), None, Some("Smith")), None, ItmpAddress(Some("1 Station Road"), Some("Town Centre"), None, None, None, None, None, None)) val enrolments = Seq(Enrolment("IR-SA", List(EnrolmentIdentifier("UTR", "174371121")))) val authority: Authority = Authority(Some("weak"),Some(200),Some("AB123456A"),Some("/uri/to/userDetails"), - Some("/uri/to/enrolments"),Some("Individual"),Some("1304372065861347")) + Some("/uri/to/enrolments"),Some("Individual")) val userDetails: UserDetails = UserDetails(None, None, None, None, None, None, None, Some("affinityGroup"), None, None, - Some("User"), None, None) + Some("User"), None, None, None, None, None) val governmentGateway: GovernmentGatewayDetails = GovernmentGatewayDetails(Some("32131"),Some(Seq("User")), - Some("affinityGroup"), Some("agent-code-12345"), Some("agent-id-12345"), Some("agent-friendly-name"), Some("gateway-token-val")) + Some("affinityGroup"), Some("agent-code-12345"), Some("agent-id-12345"), Some("agent-friendly-name"), Some("gateway-token-val"), Some(11)) + val mdtp = Mdtp("device-id-12", "session-id-133") val ggToken = Token("ggToken") - val userInfo = UserInfo(Some("John"), Some("Smith"), None, Some(Address("1 Station Road\nTown Centre", None, None, None)),None, None, Some(nino).map(_.nino), Some(enrolments), Some(governmentGateway)) + val userInfo = UserInfo(Some("John"), Some("Smith"), None, Some(Address("1 Station Road\nTown Centre", None, None, None)), + None, None, Some(nino).map(_.nino), Some(enrolments), Some(governmentGateway), Some(mdtp)) trait Setup { implicit val headers = HeaderCarrier().copy(authorization = Some(Authorization(s"Bearer $authBearerToken"))) @@ -75,7 +77,7 @@ class UserInfoServiceSpec extends UnitSpec with MockitoSugar with ScalaFutures { given(liveInfoService.thirdPartyDelegatedAuthorityConnector.fetchScopes(authBearerToken)(headers)).willReturn(scopes) given(liveInfoService.authConnector.fetchAuthority()(headers)).willReturn(Some(authority)) given(liveInfoService.authConnector.fetchEnrolments(authority)(headers)).willReturn(Some(enrolments)) - given(liveInfoService.authConnector.fetchUserDetails(authority)(headers)).willReturn(Some(userDetails)) + given(liveInfoService.authConnector.fetchUserDetails()(headers)).willReturn(Some(userDetails)) given(liveInfoService.authConnector.fetchDesUserInfo(authority)(headers)).willReturn(Some(desUserInfo)) given(liveInfoService.userInfoTransformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority),None)).willReturn(any[UserInfo], any[UserInfo]) @@ -84,7 +86,7 @@ class UserInfoServiceSpec extends UnitSpec with MockitoSugar with ScalaFutures { verify(liveInfoService.authConnector).fetchDesUserInfo(authority) verify(liveInfoService.authConnector).fetchEnrolments(authority) verify(liveInfoService.authConnector).fetchAuthority() - verify(liveInfoService.authConnector).fetchUserDetails(any[Authority])(any[HeaderCarrier]) + verify(liveInfoService.authConnector).fetchUserDetails()(any[HeaderCarrier]) } "return None when the NINO is not in the authority" in new Setup { diff --git a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala index 1a03e72..931dec5 100644 --- a/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala +++ b/test/unit/uk/gov/hmrc/openidconnect/userinfo/services/UserInfoTransformerSpec.scala @@ -19,7 +19,7 @@ package unit.uk.gov.hmrc.openidconnect.userinfo.services import org.joda.time.LocalDate import org.scalatest.BeforeAndAfterEach import org.scalatest.mock.MockitoSugar -import uk.gov.hmrc.auth.core.retrieve.{ItmpAddress, ItmpName} +import uk.gov.hmrc.auth.core.retrieve.{GatewayInformation, ItmpAddress, ItmpName, MdtpInformation} import uk.gov.hmrc.domain.Nino import uk.gov.hmrc.openidconnect.userinfo.config.{FeatureSwitch, UserInfoFeatureSwitches} import uk.gov.hmrc.openidconnect.userinfo.domain._ @@ -38,19 +38,24 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA val desUserInfo = DesUserInfo(ItmpName(Some("John"), Some("A"), Some("Smith")), Some(LocalDate.parse("1980-01-01")), desAddress) val enrolments = Seq(Enrolment("IR-SA", List(EnrolmentIdentifier("UTR", "174371121")))) + val gatewayInformation = GatewayInformation(Some("gateway-token-abc"), Some(13)) + val mdtp = Mdtp("device-id1234", "session-id-123") + val authMdtp = MdtpInformation("device-id1234", "session-id-123") val userAddress: Address = Address("1 Station Road\nTown Centre\nLondon\nEngland\nUK\nNW1 6XE\nUnited Kingdom", Some("NW1 6XE"), Some("United Kingdom"), Some("GB")) val authority: Authority = Authority(Some("weak"), Some(200), Some("AB123456A"), Some("/uri/to/userDetails"), - Some("/uri/to/enrolments"), Some("Individual"), Some("1304372065861347"), Some("gateway-token-qwert")) + Some("/uri/to/enrolments"), Some("Individual"), Some("1304372065861347")) val userDetails: UserDetails = UserDetails(email = Some("John.Smith@a.b.c.com"), affinityGroup = Some("affinityGroup"), - credentialRole = Some("User"), agentCode = Some("agent-code-12345"), agentId = Some("agent-id-12345"), agentFriendlyName = Some("agent-friendly-name")) + credentialRole = Some("User"), agentCode = Some("agent-code-12345"), agentId = Some("agent-id-12345"), + agentFriendlyName = Some("agent-friendly-name"), gatewayInformation = Some(gatewayInformation), mdtpInformation = Some(authMdtp) + ) val ggToken = Token("ggToken") val government_gateway: GovernmentGatewayDetails = GovernmentGatewayDetails(Some("1304372065861347"), Some(Seq("User")), Some("affinityGroup"), userDetails.agentCode, agent_id = userDetails.agentId, agent_friendly_name = userDetails.agentFriendlyName, - gateway_token = Some("gateway-token-qwert")) + gateway_token = Some("gateway-token-abc"), unread_message_count = Some(13)) val userInfo = UserInfo( Some("John"), @@ -61,7 +66,8 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA Some(LocalDate.parse("1980-01-01")), Some("AB123456A"), Some(enrolments), - Some(government_gateway) + Some(government_gateway), + Some(mdtp) ) @@ -86,7 +92,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "return the full object when the delegated authority has scope 'address', 'profile', 'openid:gov-uk-identifiers', 'openid:hrmc_enrolments', 'email' and 'openid:government_gateway'" in new Setup { val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway" - , "email") + , "email", "openid:mdtp") val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) @@ -99,12 +105,12 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA val result = await(transformer.transform(scopes, None, None, Option(authority), None)) - result shouldBe UserInfo(None, None, None, None, None, None, Some(nino.map(_.nino)), None, None) + result shouldBe UserInfo(None, None, None, None, None, None, Some(nino.map(_.nino)), None, None, None) } "does not return the address when the delegated authority does not have the scope 'address'" in new Setup { - val scopes = Set("profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) @@ -114,7 +120,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "does not return the enrolments when the delegated authority does not have the scope 'openid:hmrc_enrolments'" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "email", "openid:mdtp") val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) @@ -123,7 +129,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "does not return the user profile when the delegated authority does not have the scope 'profile'" in new Setup { - val scopes = Set("address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("address", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) @@ -132,7 +138,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "does not return the nino when the delegated authority does not have the scope 'openid:gov-uk-identifiers', 'openid:hmrc_enrolments'" in new Setup { - val scopes = Set("address", "profile", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) @@ -145,12 +151,12 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) - result shouldBe UserInfo(None, None, None, None, None, None, None, None, None) + result shouldBe UserInfo(None, None, None, None, None, None, None, None, None, None) } "handle missing first line of address" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val desUserMissingline1 = desUserInfo.copy(address = desAddress.copy(line1 = None)) val result = await(transformer.transform(scopes, Some(desUserMissingline1), Some(enrolments), Some(authority), Some(userDetails))) @@ -160,7 +166,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "handle missing second line of address" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val desUserMissingLine2 = desUserInfo.copy(address = desAddress.copy(line2 = None)) val result = await(transformer.transform(scopes, Some(desUserMissingLine2), Some(enrolments), Some(authority), Some(userDetails))) @@ -170,7 +176,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "handle missing third line of address" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val desUserMissingLine3 = desUserInfo.copy(address = desAddress.copy(line3 = None)) val result = await(transformer.transform(scopes, Some(desUserMissingLine3), Some(enrolments), Some(authority), Some(userDetails))) @@ -180,7 +186,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "handle missing fourth line of address" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "email", "openid:mdtp") val desUserMissingLine4 = desUserInfo.copy(address = desAddress.copy(line4 = None)) val result = await(transformer.transform(scopes, Some(desUserMissingLine4), None, Some(authority), Some(userDetails))) @@ -190,7 +196,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "handle missing fifth line of address" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "email", "openid:mdtp") val desUserMissingLine5 = desUserInfo.copy(address = desAddress.copy(line5 = None)) val result = await(transformer.transform(scopes, Some(desUserMissingLine5), None, Some(authority), Some(userDetails))) @@ -200,7 +206,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "handle missing post code in address" in new Setup { - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:government_gateway", "openid:mdtp") val desUserMissingPostCode = desUserInfo.copy(address = desAddress.copy(postCode = None)) val result = await(transformer.transform(scopes, Some(desUserMissingPostCode), None, Some(authority), Some(userDetails))) @@ -211,7 +217,7 @@ class UserInfoTransformerSpec extends UnitSpec with MockitoSugar with BeforeAndA "not return country code when feature flag is off" in new Setup { FeatureSwitch.disable(UserInfoFeatureSwitches.countryCode) - val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email") + val scopes = Set("address", "profile", "openid:gov-uk-identifiers", "openid:hmrc_enrolments", "openid:government_gateway", "email", "openid:mdtp") val result = await(transformer.transform(scopes, Some(desUserInfo), Some(enrolments), Some(authority), Some(userDetails))) val userInfoMissingCountryCode = userInfo.copy(address = Some(userAddress.copy(formatted = "1 Station Road\nTown Centre\nLondon\nEngland\nUK\nNW1 6XE\nUnited Kingdom", country_code = None))) From 2cae066e65e6d3221998f218deefcedd032dda55 Mon Sep 17 00:00:00 2001 From: Radoslaw Busz Date: Fri, 8 Sep 2017 14:30:39 +0100 Subject: [PATCH 3/4] PE-3167 - Update play-auth --- project/MicroserviceBuild.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/MicroserviceBuild.scala b/project/MicroserviceBuild.scala index e134670..9496784 100644 --- a/project/MicroserviceBuild.scala +++ b/project/MicroserviceBuild.scala @@ -29,7 +29,7 @@ private object AppDependencies { "org.scalacheck" %% "scalacheck" % "1.12.5", "uk.gov.hmrc" %% "play-hmrc-api" % "1.2.0", "uk.gov.hmrc" %% "domain" % "4.0.0", - "uk.gov.hmrc" %% "play-auth" % "2.3.0-1-gf54f401" + "uk.gov.hmrc" %% "play-auth" % 2.4.0" ) val test = Seq( From f5e80fb2260f0be514fcaaa061402c0e9f243447 Mon Sep 17 00:00:00 2001 From: Radoslaw Busz Date: Fri, 8 Sep 2017 14:51:57 +0100 Subject: [PATCH 4/4] PE-3167 - Fix build issue --- project/MicroserviceBuild.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/MicroserviceBuild.scala b/project/MicroserviceBuild.scala index 9496784..fa912f5 100644 --- a/project/MicroserviceBuild.scala +++ b/project/MicroserviceBuild.scala @@ -29,7 +29,7 @@ private object AppDependencies { "org.scalacheck" %% "scalacheck" % "1.12.5", "uk.gov.hmrc" %% "play-hmrc-api" % "1.2.0", "uk.gov.hmrc" %% "domain" % "4.0.0", - "uk.gov.hmrc" %% "play-auth" % 2.4.0" + "uk.gov.hmrc" %% "play-auth" % "2.4.0" ) val test = Seq(