Skip to content

Commit

Permalink
Merge branch '1.0.x' into PIN-4123
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli authored Oct 31, 2023
2 parents 85f41b9 + ba8a5e1 commit 43e88b0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 62 deletions.
18 changes: 0 additions & 18 deletions src/main/resources/interface-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ paths:
/clientsConsumer:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
post:
tags:
- client
Expand Down Expand Up @@ -65,7 +64,6 @@ paths:
/clientsApi:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
post:
tags:
- client
Expand Down Expand Up @@ -94,7 +92,6 @@ paths:
/clientsWithKeys:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
get:
tags:
- client
Expand Down Expand Up @@ -178,7 +175,6 @@ paths:
/clients:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
get:
tags:
- client
Expand Down Expand Up @@ -262,7 +258,6 @@ paths:
/clients/{clientId}:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
get:
description: Retrieves a Client
tags:
Expand Down Expand Up @@ -338,7 +333,6 @@ paths:
'/clients/{clientId}/operators':
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
get:
tags:
- client
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -469,7 +462,6 @@ paths:
'/clients/{clientId}/keys':
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
post:
tags:
- client
Expand Down Expand Up @@ -574,7 +566,6 @@ paths:
'/clients/{clientId}/keys/{keyId}':
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
get:
tags:
- client
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -707,7 +697,6 @@ paths:
'/clients/{clientId}/purposes':
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
post:
tags:
- client
Expand Down Expand Up @@ -753,7 +742,6 @@ paths:
'/clients/{clientId}/purposes/{purposeId}':
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
delete:
tags:
- client
Expand Down Expand Up @@ -799,7 +787,6 @@ paths:
/clients/purposes/{purposeId}:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
delete:
tags:
- client
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 43e88b0

Please sign in to comment.