Skip to content

Commit

Permalink
Merge pull request #14 from hmrc/APIS-1172
Browse files Browse the repository at this point in the history
APIS-1172 Remove endpoints from definition.json, remove redundant XML…
  • Loading branch information
antroy authored Jan 3, 2017
2 parents d9cba0a + dabe7bf commit 8da1122
Show file tree
Hide file tree
Showing 45 changed files with 52 additions and 222 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down Expand Up @@ -37,4 +37,4 @@ case class APIAccessConfig(value: Option[Configuration]) {
case None => Some(Seq())
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down Expand Up @@ -98,4 +98,3 @@ object MicroserviceGlobal extends DefaultMicroserviceGlobal with RunMode with Se

override def onHandlerNotFound(request: RequestHeader): Future[Result] = Future.successful(NotFound(Json.toJson(ErrorNotFound)))
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down Expand Up @@ -33,13 +33,6 @@ class DocumentationController(errorHandler:HttpErrorHandler) extends uk.gov.hmrc
Ok(txt.definition(buildAccess())).withHeaders("Content-Type" -> "application/json")
}

override def documentation(version: String, endpointName: String): Action[AnyContent] = Action {
Documentation.findDocumentation(endpointName, version) match {
case Some(docs) => Ok(docs).withHeaders("Content-Type" -> "application/xml")
case None => NotFound
}
}

def ramlDocs(version: String, filename: String): Action[AnyContent] = {
Assets.at(s"/public/api/conf/$version", filename)
}
Expand All @@ -51,24 +44,3 @@ class DocumentationController(errorHandler:HttpErrorHandler) extends uk.gov.hmrc
}

object DocumentationController extends DocumentationController(LazyHttpErrorHandler)

object Documentation {
val version1_0 = "1.0"
val getUserInfo = "Get user info"

def findDocumentation(endpointName: String, version: String) = applyTemplate(endpointName, version)(userInfo)

def applyTemplate(apiName: String, version: String)(info: UserInfo): Option[Xml] = {
(apiName, version) match {
case (`getUserInfo`, `version1_0`) => Some(xml.getUserInfo(info))
case _ => None
}
}

def userInfo = {
UserInfoGenerator.userInfo.sample match {
case Some(userInfo) => userInfo
case None => throw new RuntimeException("Failed to generate dynamic UserInfo")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand All @@ -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, whitelistedApplicationIds: Option[Seq[String]])
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down Expand Up @@ -59,4 +59,4 @@ trait MicroserviceAuthFilter extends Filter {
object MicroserviceAuthFilter extends MicroserviceAuthFilter with MicroserviceFilterSupport {
override lazy val authService = AuthService
override lazy val authParamsConfig = AuthParamsControllerConfiguration
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,7 @@
{
"version":"1.0",
"status":"PUBLISHED",
"access" : @Json.toJson(access),
"endpoints":[
{
"uriPattern":"/",
"endpointName":"Get user info",
"method":"GET",
"authType":"USER",
"throttlingTier":"UNLIMITED",
"scope":"openid"
}
]
"access" : @Json.toJson(access)
}
]
}
Expand Down
108 changes: 0 additions & 108 deletions app/uk/gov/hmrc/openidconnect/userinfo/views/getUserInfo.scala.xml

This file was deleted.

4 changes: 2 additions & 2 deletions conf/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016 HM Revenue & Customs
# 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.
Expand Down Expand Up @@ -303,4 +303,4 @@ Prod {
}
}
}
}
}
2 changes: 0 additions & 2 deletions conf/definition.routes
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
GET /api/definition uk.gov.hmrc.openidconnect.userinfo.controllers.DocumentationController.definition()
GET /api/documentation/:version/:endpointName uk.gov.hmrc.openidconnect.userinfo.controllers.DocumentationController.documentation(version, endpointName)
GET /api/conf/:version/*filename uk.gov.hmrc.openidconnect.userinfo.controllers.DocumentationController.ramlDocs(version, filename)

2 changes: 1 addition & 1 deletion test/it/BaseFeatureSpec.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 HM Revenue & Customs
* 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.
Expand Down
Loading

0 comments on commit 8da1122

Please sign in to comment.