diff --git a/src/main/resources/interface-specification.yml b/src/main/resources/interface-specification.yml index 36a13be8..f68e48ea 100644 --- a/src/main/resources/interface-specification.yml +++ b/src/main/resources/interface-specification.yml @@ -36,7 +36,6 @@ paths: /clientsConsumer: parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' post: tags: - client @@ -65,7 +64,6 @@ paths: /clientsApi: parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' post: tags: - client @@ -94,7 +92,6 @@ paths: /clientsWithKeys: parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' get: tags: - client @@ -178,7 +175,6 @@ paths: /clients: parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' get: tags: - client @@ -262,7 +258,6 @@ paths: /clients/{clientId}: parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' get: description: Retrieves a Client tags: @@ -338,7 +333,6 @@ paths: '/clients/{clientId}/operators': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' get: tags: - client @@ -381,7 +375,6 @@ paths: '/clients/{clientId}/relationships/{relationshipId}': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' - name: clientId in: path description: The Client id @@ -469,7 +462,6 @@ paths: '/clients/{clientId}/keys': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' post: tags: - client @@ -574,7 +566,6 @@ paths: '/clients/{clientId}/keys/{keyId}': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' get: tags: - client @@ -664,7 +655,6 @@ paths: '/clients/{clientId}/operators/{operatorId}/keys': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' - name: clientId in: path description: ID of the client holding the key @@ -707,7 +697,6 @@ paths: '/clients/{clientId}/purposes': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' post: tags: - client @@ -753,7 +742,6 @@ paths: '/clients/{clientId}/purposes/{purposeId}': parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' delete: tags: - client @@ -799,7 +787,6 @@ paths: /clients/purposes/{purposeId}: parameters: - $ref: '#/components/parameters/CorrelationIdHeader' - - $ref: '#/components/parameters/IpAddress' delete: tags: - client @@ -858,11 +845,6 @@ components: required: true schema: type: string - IpAddress: - in: header - name: X-Forwarded-For - schema: - type: string schemas: ClientSeed: description: Client creation request body diff --git a/src/main/scala/it/pagopa/interop/authorizationprocess/service/impl/AuthorizationManagementServiceImpl.scala b/src/main/scala/it/pagopa/interop/authorizationprocess/service/impl/AuthorizationManagementServiceImpl.scala index b5a82e62..d8e5909a 100644 --- a/src/main/scala/it/pagopa/interop/authorizationprocess/service/impl/AuthorizationManagementServiceImpl.scala +++ b/src/main/scala/it/pagopa/interop/authorizationprocess/service/impl/AuthorizationManagementServiceImpl.scala @@ -38,32 +38,28 @@ final case class AuthorizationManagementServiceImpl( kind: ClientKind, createdAt: OffsetDateTime, members: Seq[UUID] - )(implicit contexts: Seq[(String, String)]): Future[Client] = withHeaders[Client] { - (bearerToken, correlationId, ip) => - val request: ApiRequest[Client] = clientApi.createClient( - xCorrelationId = correlationId, - ClientSeed( - consumerId = consumerId, - name = name, - description = description, - kind = kind, - createdAt = createdAt, - members = members - ), - xForwardedFor = ip - )(BearerToken(bearerToken)) - invoker.invoke(request, "Client creation") + )(implicit contexts: Seq[(String, String)]): Future[Client] = withHeaders[Client] { (bearerToken, correlationId) => + val request: ApiRequest[Client] = clientApi.createClient( + xCorrelationId = correlationId, + ClientSeed( + consumerId = consumerId, + name = name, + description = description, + kind = kind, + createdAt = createdAt, + members = members + ) + )(BearerToken(bearerToken)) + invoker.invoke(request, "Client creation") } override def getClient( clientId: UUID )(implicit ec: ExecutionContext, readModel: ReadModelService): Future[PersistentClient] = ReadModelAuthorizationQueries.getClientById(clientId).flatMap(_.toFuture(ClientNotFound(clientId))) override def deleteClient(clientId: UUID)(implicit contexts: Seq[(String, String)]): Future[Unit] = - withHeaders[Unit] { (bearerToken, correlationId, ip) => + withHeaders[Unit] { (bearerToken, correlationId) => val request: ApiRequest[Unit] = - clientApi.deleteClient(xCorrelationId = correlationId, clientId.toString, xForwardedFor = ip)( - BearerToken(bearerToken) - ) + clientApi.deleteClient(xCorrelationId = correlationId, clientId.toString)(BearerToken(bearerToken)) invoker .invoke(request, "Client delete") .recoverWith { @@ -72,20 +68,18 @@ final case class AuthorizationManagementServiceImpl( } override def addRelationship(clientId: UUID, relationshipId: UUID)(implicit contexts: Seq[(String, String)] - ): Future[Client] = withHeaders[Client] { (bearerToken, correlationId, ip) => - val request: ApiRequest[Client] = clientApi.addRelationship( - xCorrelationId = correlationId, - clientId, - PartyRelationshipSeed(relationshipId), - xForwardedFor = ip - )(BearerToken(bearerToken)) + ): Future[Client] = withHeaders[Client] { (bearerToken, correlationId) => + val request: ApiRequest[Client] = + clientApi.addRelationship(xCorrelationId = correlationId, clientId, PartyRelationshipSeed(relationshipId))( + BearerToken(bearerToken) + ) invoker.invoke(request, "Operator addition to client") } override def removeClientRelationship(clientId: UUID, relationshipId: UUID)(implicit contexts: Seq[(String, String)] - ): Future[Unit] = withHeaders[Unit] { (bearerToken, correlationId, ip) => + ): Future[Unit] = withHeaders[Unit] { (bearerToken, correlationId) => val request: ApiRequest[Unit] = - clientApi.removeClientRelationship(xCorrelationId = correlationId, clientId, relationshipId, xForwardedFor = ip)( + clientApi.removeClientRelationship(xCorrelationId = correlationId, clientId, relationshipId)( BearerToken(bearerToken) ) invoker @@ -104,11 +98,9 @@ final case class AuthorizationManagementServiceImpl( key <- keys.find(_.kid == kid).toFuture(ClientKeyNotFound(clientId, kid)) } yield key override def deleteKey(clientId: UUID, kid: String)(implicit contexts: Seq[(String, String)]): Future[Unit] = - withHeaders[Unit] { (bearerToken, correlationId, ip) => + withHeaders[Unit] { (bearerToken, correlationId) => val request: ApiRequest[Unit] = - keyApi.deleteClientKeyById(xCorrelationId = correlationId, clientId, kid, xForwardedFor = ip)( - BearerToken(bearerToken) - ) + keyApi.deleteClientKeyById(xCorrelationId = correlationId, clientId, kid)(BearerToken(bearerToken)) invoker .invoke(request, "Key Delete") .recoverWith { @@ -122,11 +114,9 @@ final case class AuthorizationManagementServiceImpl( } override def createKeys(clientId: UUID, keysSeeds: Seq[KeySeed])(implicit contexts: Seq[(String, String)] - ): Future[Keys] = withHeaders[Keys] { (bearerToken, correlationId, ip) => + ): Future[Keys] = withHeaders[Keys] { (bearerToken, correlationId) => val request: ApiRequest[Keys] = - keyApi.createKeys(xCorrelationId = correlationId, clientId, keysSeeds, xForwardedFor = ip)( - BearerToken(bearerToken) - ) + keyApi.createKeys(xCorrelationId = correlationId, clientId, keysSeeds)(BearerToken(bearerToken)) invoker .invoke(request, "Key creation") .recoverWith { @@ -136,11 +126,9 @@ final case class AuthorizationManagementServiceImpl( } override def addClientPurpose(clientId: UUID, purposeSeed: PurposeSeed)(implicit contexts: Seq[(String, String)] - ): Future[Purpose] = withHeaders[Purpose] { (bearerToken, correlationId, ip) => + ): Future[Purpose] = withHeaders[Purpose] { (bearerToken, correlationId) => val request: ApiRequest[Purpose] = - purposeApi.addClientPurpose(xCorrelationId = correlationId, clientId, purposeSeed, xForwardedFor = ip)( - BearerToken(bearerToken) - ) + purposeApi.addClientPurpose(xCorrelationId = correlationId, clientId, purposeSeed)(BearerToken(bearerToken)) invoker .invoke(request, "Purpose addition to client") .recoverWith { @@ -149,11 +137,9 @@ final case class AuthorizationManagementServiceImpl( } override def removeClientPurpose(clientId: UUID, purposeId: UUID)(implicit contexts: Seq[(String, String)] - ): Future[Unit] = withHeaders[Unit] { (bearerToken, correlationId, ip) => + ): Future[Unit] = withHeaders[Unit] { (bearerToken, correlationId) => val request: ApiRequest[Unit] = - purposeApi.removeClientPurpose(xCorrelationId = correlationId, clientId, purposeId, xForwardedFor = ip)( - BearerToken(bearerToken) - ) + purposeApi.removeClientPurpose(xCorrelationId = correlationId, clientId, purposeId)(BearerToken(bearerToken)) invoker .invoke(request, "Purpose remove from client") .recoverWith {