Repository: hmrc/income-tax-submission
Pull request #101: SASS-11006: Enabling Multi- Agent for Income-tax-submission - Backend
Author: login: iyadi
Created: 2025-03-13T12:27:40Z | Merged: 2025-03-18T14:21:47Z

### Description
Please include a brief summary of the change you've made and the issue that it fixes.

Add a link to the relevant story in Jira
[SASS-CHANGE-ME](ADD URL HERE)

### Checklist PR Reviewer
##### Before Reviewing
- [ ]  Have you pulled the branch down?
- [ ]  Have you assigned yourself to the PR?
- [ ]  Have you moved the task to “in review” on JIRA?
- [ ]  Have you checked to ensure all dependencies are up to date?
- [ ]  Have you checked to ensure its been rebased against the current version of main?

##### Whilst Reviewing
- [ ]  Have you run the tests?
- [ ]  Have you run the journey tests?
- [ ]  Have you looked at the JIRA story to make sure all Acceptance Criteria has been met?

##### After Reviewing
- [ ]  Have you checked for merge conflicts or any changes in the current main that may affect the current pull request? i.e. does it need another rebase?
- [ ]  Have you checked to make sure there are no builds in the pipeline before you merge?
- [ ]  Have you moved the task to “in pipeline” on Jira?

### Checklist PR Raiser
##### Before creating PR
- [ ]  Have you run the tests?
- [ ]  Have you run the journey tests? (where applicable)
- [ ]  Have you addressed warnings where appropriate?
- [ ]  Have you rebased against the current version of main?
- [ ]  Have you checked code coverage isn’t lower than previously?

##### After PRs been raised
- [ ]  Have you checked the PR Builder passes?



Diff:
diff --git a/app/common/EnrolmentCommon.scala b/app/common/EnrolmentCommon.scala
index 6412947..90cda1e 100644
--- a/app/common/EnrolmentCommon.scala
+++ b/app/common/EnrolmentCommon.scala
@@ -18,7 +18,6 @@ package common
 
 object EnrolmentKeys {
   val Individual = "HMRC-MTD-IT"
-  val SupportingAgent = "HMRC-MTD-IT-SUPP"
   val Agent = "HMRC-AS-AGENT"
   val nino = "HMRC-NI"
 }
@@ -31,5 +30,4 @@ object EnrolmentIdentifiers {
 
 object DelegatedAuthRules {
   val agentDelegatedAuthRule = "mtd-it-auth"
-  val supportingAgentDelegatedAuthRule = "mtd-it-auth-supp"
 }
diff --git a/app/config/AppConfig.scala b/app/config/AppConfig.scala
index e80c2c7..26ce1cc 100644
--- a/app/config/AppConfig.scala
+++ b/app/config/AppConfig.scala
@@ -39,7 +39,6 @@ class BackendAppConfig @Inject()(config: Configuration, servicesConfig: Services
 
   //Feature switching
   val auditingEnabled: Boolean = config.get[Boolean]("auditing.enabled")
-  def emaSupportingAgentsEnabled: Boolean = config.get[Boolean]("feature-switch.ema-supporting-agents-enabled")
 
   //Mongo config
   lazy val encryptionKey: String = servicesConfig.getString("mongodb.encryption.key")
@@ -65,7 +64,6 @@ trait AppConfig {
 
   //Feature switching
   val auditingEnabled: Boolean
-  def emaSupportingAgentsEnabled: Boolean
 
   //Mongo config
   val encryptionKey: String
diff --git a/app/controllers/predicates/AuthorisedAction.scala b/app/controllers/predicates/AuthorisedAction.scala
index 770cdd8..6515d3d 100644
--- a/app/controllers/predicates/AuthorisedAction.scala
+++ b/app/controllers/predicates/AuthorisedAction.scala
@@ -17,7 +17,6 @@
 package controllers.predicates
 
 import common.{DelegatedAuthRules, EnrolmentIdentifiers, EnrolmentKeys}
-import config.AppConfig
 import models.User
 import models.logging.CorrelationIdMdc.withEnrichedCorrelationId
 import play.api.Logger
@@ -36,7 +35,6 @@ import scala.util.matching.Regex
 
 class AuthorisedAction @Inject()()(implicit val authConnector: AuthConnector,
                                    defaultActionBuilder: DefaultActionBuilder,
-                                   appConfig: AppConfig,
                                    val cc: ControllerComponents) extends AuthorisedFunctions {
 
   lazy val logger: Logger = Logger.apply(this.getClass)
@@ -123,11 +121,6 @@ class AuthorisedAction @Inject()()(implicit val authConnector: AuthConnector,
       .withIdentifier(EnrolmentIdentifiers.individualId, mtdId)
       .withDelegatedAuthRule(DelegatedAuthRules.agentDelegatedAuthRule)
 
-  private[predicates] def secondaryAgentPredicate(mtdId: String): Predicate =
-    Enrolment(EnrolmentKeys.SupportingAgent)
-      .withIdentifier(EnrolmentIdentifiers.individualId, mtdId)
-      .withDelegatedAuthRule(DelegatedAuthRules.supportingAgentDelegatedAuthRule)
-
   private[predicates] def agentAuthentication[A](block: User[A] => Future[Result], requestMtdItId: String)
                                                 (implicit request: Request[A], hc: HeaderCarrier): Future[Result] = {
 
@@ -137,8 +130,8 @@ class AuthorisedAction @Inject()()(implicit val authConnector: AuthConnector,
       case ninoRegex(nino) =>
         authorised(agentAuthPredicate(requestMtdItId))
           .retrieve(allEnrolments) {
-            populateAgent(block, requestMtdItId, nino, _, isSupportingAgent = false)
-          }.recoverWith(agentRecovery(block, requestMtdItId, nino))
+            populateAgent(block, requestMtdItId, nino, _)
+          }.recoverWith(agentRecovery())
       case _ =>
         logger.warn(s"$agentAuthLogString - Could not parse Nino from uri")
         Future(Unauthorized)
@@ -147,25 +140,10 @@ class AuthorisedAction @Inject()()(implicit val authConnector: AuthConnector,
 
   private val agentAuthLogString: String = "[AuthorisedAction][agentAuthentication]"
 
-  private def agentRecovery[A](block: User[A] => Future[Result],
-                               mtdItId: String,
-                               nino: String)
-                              (implicit request: Request[A], hc: HeaderCarrier): PartialFunction[Throwable, Future[Result]] = {
+  private def agentRecovery(): PartialFunction[Throwable, Future[Result]] = {
     case _: NoActiveSession =>
       logger.warn(s"$agentAuthLogString - No active session.")
       unauthorized
-    case _: AuthorisationException if appConfig.emaSupportingAgentsEnabled =>
-      authorised(secondaryAgentPredicate(mtdItId))
-        .retrieve(allEnrolments) {
-          populateAgent(block, mtdItId, nino, _, isSupportingAgent = true)
-        }.recoverWith {
-          case _: AuthorisationException =>
-            logger.warn(s"$agentAuthLogString - Agent does not have secondary delegated authority for Client.")
-            unauthorized
-          case e =>
-            logger.error(s"$agentAuthLogString - Unexpected exception of type '${e.getClass.getSimpleName}' was caught.")
-            Future.successful(InternalServerError)
-        }
     case _: AuthorisationException =>
       logger.warn(s"$agentAuthLogString - Agent does not have delegated authority for Client.")
       unauthorized
@@ -177,15 +155,14 @@ class AuthorisedAction @Inject()()(implicit val authConnector: AuthConnector,
   private def populateAgent[A](block: User[A] => Future[Result],
                                requestMtdItId: String,
                                nino: String,
-                               enrolments: Enrolments,
-                               isSupportingAgent: Boolean)(implicit request: Request[A], hc: HeaderCarrier): Future[Result] = {
+                               enrolments: Enrolments)(implicit request: Request[A], hc: HeaderCarrier): Future[Result] = {
     enrolmentGetIdentifierValue(EnrolmentKeys.Agent, EnrolmentIdentifiers.agentReference, enrolments) match {
       case Some(arn) =>
         sessionId.fold {
           logger.warn(s"$agentAuthLogString - No session id in request")
           unauthorized
         } { sessionId =>
-          block(User(requestMtdItId, Some(arn), nino, sessionId, isSupportingAgent))
+          block(User(requestMtdItId, Some(arn), nino, sessionId))
         }
       case None =>
         logger.warn(s"$agentAuthLogString Agent with no HMRC-AS-AGENT enrolment.")
diff --git a/app/models/User.scala b/app/models/User.scala
index 140d852..7a0eeab 100644
--- a/app/models/User.scala
+++ b/app/models/User.scala
@@ -21,8 +21,7 @@ import play.api.mvc.{Request, WrappedRequest}
 case class User[T](mtditid: String,
                    arn: Option[String],
                    nino: String,
-                   sessionId: String,
-                   isSupportingAgent: Boolean = false)
+                   sessionId: String)
                   (implicit request: Request[T]) extends WrappedRequest[T](request) {
   def isAgent: Boolean = arn.nonEmpty
 }
diff --git a/check.sh b/check.sh
index c2bfa94..efaaf74 100755
--- a/check.sh
+++ b/check.sh
@@ -1,3 +1,3 @@
 #!/usr/bin/env bash
 
-sbt clean scalastyle coverage test it:test coverageReport
+sbt clean scalastyle coverage test it/test coverageReport
diff --git a/conf/application.conf b/conf/application.conf
index 61ddd9f..a3cf521 100644
--- a/conf/application.conf
+++ b/conf/application.conf
@@ -128,6 +128,6 @@ microservice {
 }
 
 feature-switch {
-  ema-supporting-agents-enabled = true
+
 }
 
diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala
index 8061a4b..ea5c5ec 100644
--- a/project/AppDependencies.scala
+++ b/project/AppDependencies.scala
@@ -19,8 +19,8 @@ import sbt._
 
 object AppDependencies {
 
-  private val bootstrapPlay30Version = "9.5.0"
-  private val mongoVersion = "2.2.0"
+  private val bootstrapPlay30Version = "9.11.0"
+  private val mongoVersion = "2.5.0"
 
   private val jacksonAndPlayExclusions: Seq[InclusionRule] = Seq(
     ExclusionRule(organization = "com.fasterxml.jackson.core"),
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 1910287..0a09c9c 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,11 +1,11 @@
 resolvers += MavenRepository("HMRC-open-artefacts-maven2", "https://open.artefacts.tax.service.gov.uk/maven2")
 resolvers += Resolver.url("HMRC-open-artefacts-ivy", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns)
 
-addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.22.0")
+addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.24.0")
 
-addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0")
+addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.6.0")
 
-addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.5")
+addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.6")
 
 addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
 
diff --git a/test/common/EnrolmentCommonSpec.scala b/test/common/EnrolmentCommonSpec.scala
index 1f67053..ab85247 100644
--- a/test/common/EnrolmentCommonSpec.scala
+++ b/test/common/EnrolmentCommonSpec.scala
@@ -24,7 +24,6 @@ class EnrolmentCommonSpec extends AnyWordSpec with Matchers {
   "EnrolmentKeys" should {
     "have the correct values" in {
       EnrolmentKeys.Individual mustBe "HMRC-MTD-IT"
-      EnrolmentKeys.SupportingAgent mustBe "HMRC-MTD-IT-SUPP"
       EnrolmentKeys.Agent mustBe "HMRC-AS-AGENT"
       EnrolmentKeys.nino mustBe "HMRC-NI"
     }
@@ -41,7 +40,6 @@ class EnrolmentCommonSpec extends AnyWordSpec with Matchers {
   "DelegatedAuthRules" should {
     "have the correct values" in {
       DelegatedAuthRules.agentDelegatedAuthRule mustBe "mtd-it-auth"
-      DelegatedAuthRules.supportingAgentDelegatedAuthRule mustBe "mtd-it-auth-supp"
     }
   }
 
diff --git a/test/controllers/ExcludeJourneyControllerSpec.scala b/test/controllers/ExcludeJourneyControllerSpec.scala
index af2a8ea..e346a3c 100644
--- a/test/controllers/ExcludeJourneyControllerSpec.scala
+++ b/test/controllers/ExcludeJourneyControllerSpec.scala
@@ -18,15 +18,15 @@ package controllers
 
 import common.IncomeSources._
 import controllers.predicates.AuthorisedAction
-import models.mongo.{DatabaseError, ExclusionUserDataModel, MongoError}
 import models._
+import models.mongo.{DatabaseError, ExclusionUserDataModel, MongoError}
 import play.api.http.Status.{BAD_REQUEST, INTERNAL_SERVER_ERROR, NO_CONTENT, OK}
 import play.api.libs.json.Json
 import play.api.mvc.AnyContentAsEmpty
 import play.api.test.FakeRequest
 import services.ExcludeJourneyService
 import uk.gov.hmrc.http.HeaderCarrier
-import utils.{MockAppConfig, TestUtils}
+import utils.TestUtils
 
 import java.time.Instant
 import scala.concurrent.Future
@@ -42,7 +42,7 @@ class ExcludeJourneyControllerSpec extends TestUtils {
   private val taxYear = 2023
   private lazy val mockService = mock[ExcludeJourneyService]
 
-  private lazy val auth = new AuthorisedAction()(mockAuthConnector, defaultActionBuilder, new MockAppConfig(), mockControllerComponents)
+  private lazy val auth = new AuthorisedAction()(mockAuthConnector, defaultActionBuilder,  mockControllerComponents)
 
   private lazy val controller = new ExcludeJourneyController(
     mockControllerComponents,
diff --git a/test/controllers/predicates/AuthorisedActionSpec.scala b/test/controllers/predicates/AuthorisedActionSpec.scala
index b5a9330..9863d43 100644
--- a/test/controllers/predicates/AuthorisedActionSpec.scala
+++ b/test/controllers/predicates/AuthorisedActionSpec.scala
@@ -37,7 +37,7 @@ class AuthorisedActionSpec extends TestUtils {
 
   override lazy val mockAppConfig: AppConfig = mock[AppConfig]
   override val authorisedAction: AuthorisedAction = {
-    new AuthorisedAction()(mockAuthConnector, defaultActionBuilder, mockAppConfig, mockControllerComponents)
+    new AuthorisedAction()(mockAuthConnector, defaultActionBuilder, mockControllerComponents)
   }
 
   ".enrolmentGetIdentifierValue" should {
@@ -351,80 +351,17 @@ class AuthorisedActionSpec extends TestUtils {
           bodyOf(result) mustBe "1234567890 0987654321"
         }
       }
-
-      "the agent is authorised as an ema supporting agent, and the supporting agent feature is enabled" which {
-
-        val enrolments = Enrolments(Set(
-          Enrolment(
-            key = EnrolmentKeys.SupportingAgent,
-            identifiers = Seq(EnrolmentIdentifier(EnrolmentIdentifiers.individualId, "1234567890")),
-            state = "Activated",
-            delegatedAuthRule = Some(DelegatedAuthRules.supportingAgentDelegatedAuthRule)
-          ),
-          Enrolment(
-            key = EnrolmentKeys.Agent,
-            identifiers = Seq(EnrolmentIdentifier(EnrolmentIdentifiers.agentReference, "0987654321")),
-            state = "Activated"
-          )
-        ))
-
-        lazy val result = {
-
-          //First auth call to fail
-          object AuthException extends AuthorisationException("not primary agent")
-          mockAuthReturnException(AuthException).once()
-
-          //Then check if Supporting Agent is enabled
-          (() => mockAppConfig.emaSupportingAgentsEnabled).expects().returning(true)
-
-          //Second call for supporting agent
-          (mockAuthConnector.authorise(_: Predicate, _: Retrieval[_])(_: HeaderCarrier, _: ExecutionContext))
-            .expects(*, Retrievals.allEnrolments, *, *)
-            .returning(Future.successful(enrolments))
-            .once()
-
-          authorisedAction.agentAuthentication(block, "1234567890")(fakeRequest, emptyHeaderCarrier)
-        }
-
-        "has a status of OK" in {
-          status(result) mustBe OK
-        }
-
-        "has the correct body" in {
-          bodyOf(result) mustBe "1234567890 0987654321"
-        }
-      }
     }
 
     "return an Unauthorised" when {
 
-      "the authorisation service returns an AuthorisationException exception (and ema supporting agent is disabled)" in {
-        object AuthException extends AuthorisationException("Some reason")
-
-        lazy val result = {
-          mockAuthReturnException(AuthException)
-
-          //Disable EMA Supporting Agent feature
-          (() => mockAppConfig.emaSupportingAgentsEnabled).expects().returning(false)
-
-          authorisedAction.agentAuthentication(block, "1234567890")(fakeRequest, emptyHeaderCarrier)
-        }
-        status(result) mustBe UNAUTHORIZED
-      }
-
-      "the authorisation service returns an AuthorisationException exception for a delegated ema Support Agent" in {
+      "the authorisation service returns an AuthorisationException" in {
         object AuthException extends AuthorisationException("Some reason")
 
         lazy val result = {
 
           //First auth failure to simulate not being a primary agent
-          mockAuthReturnException(AuthException).once()
-
-          //Enable EMA Supporting Agent feature
-          (() => mockAppConfig.emaSupportingAgentsEnabled).expects().returning(true)
-
-          //Second auth failure to simiulate not being a supporting agent
-          mockAuthReturnException(AuthException).once()
+          mockAuthReturnException(AuthException)
 
           authorisedAction.agentAuthentication(block, "1234567890")(fakeRequest, emptyHeaderCarrier)
         }
@@ -500,26 +437,6 @@ class AuthorisedActionSpec extends TestUtils {
         }
         status(result) mustBe INTERNAL_SERVER_ERROR
       }
-
-      "[EMA enabled] secondary agent auth call returns an unexpected error" in {
-        object AuthException extends AuthorisationException("Some reason")
-        object OtherException extends IndexOutOfBoundsException("Some reason")
-
-        lazy val result = {
-
-          //First auth failure to simulate not being a primary agent
-          mockAuthReturnException(AuthException).once()
-
-          //Enable EMA Supporting Agent feature
-          (() => mockAppConfig.emaSupportingAgentsEnabled).expects().returning(true)
-
-          //Second auth failure to simiulate not being a supporting agent
-          mockAuthReturnException(OtherException).once()
-
-          authorisedAction.agentAuthentication(block, "1234567890")(fakeRequest, emptyHeaderCarrier)
-        }
-        status(result) mustBe INTERNAL_SERVER_ERROR
-      }
     }
   }
 
@@ -544,20 +461,6 @@ class AuthorisedActionSpec extends TestUtils {
         }
       }
 
-      "the user is successfully verified as a ema supporting agent (feature is enabled)" which {
-
-        lazy val result: Future[Result] = {
-          mockAuthAsSupportingAgent()
-          authorisedAction.async(block)(fakeRequest)
-        }
-
-        "should return an OK(200) status" in {
-
-          status(result) mustBe OK
-          bodyOf(result) mustBe "mtditid: 1234567890 arn: 0987654321"
-        }
-      }
-
       "the user is successfully verified as an individual" in {
 
         lazy val result = {
diff --git a/test/utils/MockAppConfig.scala b/test/utils/MockAppConfig.scala
index 2c3b26e..80dcc8a 100644
--- a/test/utils/MockAppConfig.scala
+++ b/test/utils/MockAppConfig.scala
@@ -19,8 +19,7 @@ package utils
 import config.AppConfig
 import org.scalamock.scalatest.MockFactory
 
-class MockAppConfig(isEncrypted: Boolean = true,
-                    supportingAgentsEnabled: Boolean = false) extends AppConfig with MockFactory {
+class MockAppConfig(isEncrypted: Boolean = true) extends AppConfig with MockFactory {
 
   private val host: String = "http://localhost:11111"
 
@@ -38,7 +37,6 @@ class MockAppConfig(isEncrypted: Boolean = true,
 
 
   override val auditingEnabled: Boolean = true
-  override val emaSupportingAgentsEnabled: Boolean = supportingAgentsEnabled
 
   override lazy val encryptionKey: String = "encryptionKey12345"
   override lazy val mongoTTL: Int = 1550
diff --git a/test/utils/TestUtils.scala b/test/utils/TestUtils.scala
index a8adcf0..f721dc2 100644
--- a/test/utils/TestUtils.scala
+++ b/test/utils/TestUtils.scala
@@ -61,7 +61,7 @@ trait TestUtils extends AnyWordSpec with Matchers with MockFactory with BeforeAn
   implicit val mockAuthConnector: AuthConnector = mock[AuthConnector]
   implicit val mockAuthService: AuthService = new AuthService(mockAuthConnector)
   val defaultActionBuilder: DefaultActionBuilder = DefaultActionBuilder(mockControllerComponents.parsers.default)
-  val authorisedAction = new AuthorisedAction()(mockAuthConnector, defaultActionBuilder, mockAppConfig, mockControllerComponents)
+  val authorisedAction = new AuthorisedAction()(mockAuthConnector, defaultActionBuilder, mockControllerComponents)
 
 
   def status(awaitable: Future[Result]): Int = await(awaitable).header.status
@@ -105,30 +105,6 @@ trait TestUtils extends AnyWordSpec with Matchers with MockFactory with BeforeAn
       .returning(Future.successful(enrolments))
   }
 
-  //noinspection ScalaStyle
-  def mockAuthAsSupportingAgent(enrolments: Enrolments = agentEnrolments) = {
-    (mockAuthConnector.authorise(_: Predicate, _: Retrieval[_])(_: HeaderCarrier, _: ExecutionContext))
-      .expects(*, Retrievals.affinityGroup, *, *)
-      .returning(Future.successful(Some(AffinityGroup.Agent)))
-      .once()
-
-    (mockAuthConnector.authorise(_: Predicate, _: Retrieval[_])(_: HeaderCarrier, _: ExecutionContext))
-      .expects(Enrolment(EnrolmentKeys.Individual)
-        .withIdentifier(EnrolmentIdentifiers.individualId, "1234567890")
-        .withDelegatedAuthRule(DelegatedAuthRules.agentDelegatedAuthRule), *, *, *)
-      .returning(Future.failed(InsufficientEnrolments()))
-      .once()
-
-    (() => mockAppConfig.emaSupportingAgentsEnabled).expects().returning(true).once()
-
-    (mockAuthConnector.authorise(_: Predicate, _: Retrieval[_])(_: HeaderCarrier, _: ExecutionContext))
-      .expects(Enrolment(EnrolmentKeys.SupportingAgent)
-        .withIdentifier(EnrolmentIdentifiers.individualId, "1234567890")
-        .withDelegatedAuthRule(DelegatedAuthRules.supportingAgentDelegatedAuthRule), *, *, *)
-      .returning(Future.successful(enrolments))
-      .once()
-  }
-
   //noinspection ScalaStyle
   def mockAuthReturnException(exception: Exception): CallHandler4[Predicate, Retrieval[_], HeaderCarrier, ExecutionContext, Future[Any]] = {
     (mockAuthConnector.authorise(_: Predicate, _: Retrieval[_])(_: HeaderCarrier, _: ExecutionContext))


Reviews:
user: login: matthewwardcap
body: https://github.com/hmrc/income-tax-submission/blob/7f915a96ad67a953785ca351378cb58f447b884d/test/controllers/predicates/AuthorisedActionSpec.scala#L355

1) When updating tests remove references to feature switch

2) Update dependencies

3) Fix PR-bot comments
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-14T09:30:33Z
user: login: baha-aboukoura
state: CHANGES_REQUESTED
author_association: NONE
submitted_at: 2025-03-14T14:49:55Z
user: login: baha-aboukoura
state: CHANGES_REQUESTED
author_association: NONE
submitted_at: 2025-03-17T15:52:05Z
user: login: baha-aboukoura
state: CHANGES_REQUESTED
author_association: NONE
submitted_at: 2025-03-17T16:11:55Z
user: login: baha-aboukoura
state: APPROVED
author_association: NONE
submitted_at: 2025-03-18T14:12:11Z
user: login: matthewwardcap
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-18T14:17:21Z

Review comments:
diff_hunk: @@ -147,25 +140,10 @@ class AuthorisedAction @Inject()()(implicit val authConnector: AuthConnector,
 
   private val agentAuthLogString: String = "[AuthorisedAction][agentAuthentication]"
 
-  private def agentRecovery[A](block: User[A] => Future[Result],
-                               mtdItId: String,
-                               nino: String)
-                              (implicit request: Request[A], hc: HeaderCarrier): PartialFunction[Throwable, Future[Result]] = {
+  private def agentRecovery[A](): PartialFunction[Throwable, Future[Result]] = {
path: app/controllers/predicates/AuthorisedAction.scala
user: login: baha-aboukoura
body: [A] declaration is never used 
created_at: 2025-03-14T14:48:48Z
author_association: NONE
diff_hunk: @@ -510,15 +482,10 @@ class AuthorisedActionSpec extends TestUtils {
           //First auth failure to simulate not being a primary agent
           mockAuthReturnException(AuthException).once()
 
-          //Enable EMA Supporting Agent feature
-          (() => mockAppConfig.emaSupportingAgentsEnabled).expects().returning(true)
-
-          //Second auth failure to simiulate not being a supporting agent
-          mockAuthReturnException(OtherException).once()
path: test/controllers/predicates/AuthorisedActionSpec.scala
user: login: baha-aboukoura
body: OtherException is still defined and not being used on line 478
created_at: 2025-03-17T15:51:57Z
author_association: NONE
diff_hunk: @@ -510,15 +482,10 @@ class AuthorisedActionSpec extends TestUtils {
           //First auth failure to simulate not being a primary agent
path: test/controllers/predicates/AuthorisedActionSpec.scala
user: login: baha-aboukoura
body: this test still has EMA enabled in the title
created_at: 2025-03-17T16:11:50Z
author_association: NONE

PR comments:
user: login: platops-pr-bot
created_at: 2025-03-13T12:31:33Z
body: - `uk.gov.hmrc.sbt-auto-build` can be updated to `3.24.0` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L4)
- `uk.gov.hmrc.sbt-distributables` can be updated to `2.6.0` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L6)
- `uk.gov.hmrc:bootstrap-backend-play-30` can be updated to `9.11.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).
- `uk.gov.hmrc.mongo:hmrc-mongo-play-30` can be updated to `2.5.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).
- `uk.gov.hmrc:bootstrap-test-play-30` can be updated to `9.11.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).
- `uk.gov.hmrc.mongo:hmrc-mongo-test-play-30` can be updated to `2.5.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).
- There is a bobby warning (builds will be prevented after 14 Jul 2025) - see the pr builder for details
- There is a bobby warning (builds will be prevented after 31 May 2025) - see the pr builder for details
author_association: NONE
user: login: platops-pr-bot
created_at: 2025-03-17T11:50:33Z
body: - ~~`uk.gov.hmrc.sbt-auto-build` can be updated to `3.24.0` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L4)~~
- ~~`uk.gov.hmrc.sbt-distributables` can be updated to `2.6.0` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L6)~~
- ~~`uk.gov.hmrc:bootstrap-backend-play-30` can be updated to `9.11.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~`uk.gov.hmrc.mongo:hmrc-mongo-play-30` can be updated to `2.5.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~`uk.gov.hmrc:bootstrap-test-play-30` can be updated to `9.11.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~`uk.gov.hmrc.mongo:hmrc-mongo-test-play-30` can be updated to `2.5.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~There is a bobby warning (builds will be prevented after 14 Jul 2025) - see the pr builder for details~~
- ~~There is a bobby warning (builds will be prevented after 31 May 2025) - see the pr builder for details~~
- Runtime issues may occur. Change `org.playframework:sbt-plugin` to `3.0.6` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L8) - to match what `uk.gov.hmrc.bootstrap-backend-play-30` uses
author_association: NONE
user: login: platops-pr-bot
created_at: 2025-03-17T12:08:14Z
body: - ~~`uk.gov.hmrc.sbt-auto-build` can be updated to `3.24.0` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L4)~~
- ~~`uk.gov.hmrc.sbt-distributables` can be updated to `2.6.0` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L6)~~
- ~~`uk.gov.hmrc:bootstrap-backend-play-30` can be updated to `9.11.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~`uk.gov.hmrc.mongo:hmrc-mongo-play-30` can be updated to `2.5.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~`uk.gov.hmrc:bootstrap-test-play-30` can be updated to `9.11.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~`uk.gov.hmrc.mongo:hmrc-mongo-test-play-30` can be updated to `2.5.0` in [project/AppDependencies.scala](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/AppDependencies.scala#L1).~~
- ~~There is a bobby warning (builds will be prevented after 14 Jul 2025) - see the pr builder for details~~
- ~~There is a bobby warning (builds will be prevented after 31 May 2025) - see the pr builder for details~~
- ~~Runtime issues may occur. Change `org.playframework:sbt-plugin` to `3.0.6` in [project/plugins.sbt](https://github.com/hmrc/income-tax-submission/blob/SASS-11301/project/plugins.sbt#L8) - to match what `uk.gov.hmrc.bootstrap-backend-play-30` uses~~
author_association: NONE