private def oktaRefine[A]()

in membership-attribute-service/app/actions/AuthAndBackendViaIdapiAction.scala [43:72]


  private def oktaRefine[A](request: Request[A], user: UserFromToken): AuthAndBackendRequest[A] =
    new AuthAndBackendRequest(
      redirectAdvice = RedirectAdviceResponse(
        signInStatus = SignedInRecently,
        userId = Some(user.identityId),
        displayName = user.username,
        emailValidated = user.userEmailValidated,
        // Okta reauthentication redirect will be managed by the API client
        redirect = None,
      ),
      touchpoint = backend(user.primaryEmailAddress)(user.logPrefix),
      request,
    )

  private def idapiRefine[A](request: Request[A], primaryEmailAddress: String)(implicit
      logPrefix: LogPrefix,
  ): Future[Either[Result, AuthAndBackendRequest[A]]] =
    touchpointBackends.normal.idapiService.RedirectAdvice
      .getRedirectAdvice(
        request.headers.get(IdapiService.HeaderNameCookie).getOrElse(""),
        request.headers.get(IdapiService.HeaderNameIdapiForwardedScope),
      )
      .map(redirectAdvice =>
        howToHandleRecencyOfSignedIn match {
          case Return401IfNotSignedInRecently if redirectAdvice.signInStatus != SignedInRecently =>
            Left(Results.Unauthorized.withHeaders(("X-GU-IDAPI-Redirect", redirectAdvice.redirect.map(_.url).getOrElse(""))))
          case _ =>
            val backendConf = backend(primaryEmailAddress)
            Right(new AuthAndBackendRequest[A](redirectAdvice, backendConf, request))
        },