From 5d77475ee14900f127ef938f6b31e886a8e3fab6 Mon Sep 17 00:00:00 2001 From: Federica Agostini Date: Mon, 11 Sep 2023 15:57:25 +0200 Subject: [PATCH] Save AT/RT lifetime from client registration req --- .../api/client/service/ClientConverter.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/iam-login-service/src/main/java/it/infn/mw/iam/api/client/service/ClientConverter.java b/iam-login-service/src/main/java/it/infn/mw/iam/api/client/service/ClientConverter.java index 74a6eb27b..aea7903f3 100644 --- a/iam-login-service/src/main/java/it/infn/mw/iam/api/client/service/ClientConverter.java +++ b/iam-login-service/src/main/java/it/infn/mw/iam/api/client/service/ClientConverter.java @@ -193,19 +193,16 @@ public ClientDetailsEntity entityFromRegistrationRequest(RegisteredClientDTO dto client.setLogoUri(dto.getLogoUri()); client.setPolicyUri(dto.getPolicyUri()); - + client.setRedirectUris(cloneSet(dto.getRedirectUris())); client.setScope(cloneSet(dto.getScope())); - - client.setGrantTypes(new HashSet<>()); + + client.setGrantTypes(new HashSet<>()); if (!isNull(dto.getGrantTypes())) { client.setGrantTypes( - dto.getGrantTypes() - .stream() - .map(AuthorizationGrantType::getGrantType) - .collect(toSet())); + dto.getGrantTypes().stream().map(AuthorizationGrantType::getGrantType).collect(toSet())); } if (dto.getScope().contains("offline_access")) { @@ -231,6 +228,14 @@ public ClientDetailsEntity entityFromRegistrationRequest(RegisteredClientDTO dto client.setCodeChallengeMethod(pkceAlgo); } + if (dto.getAccessTokenValiditySeconds() != null) { + client.setAccessTokenValiditySeconds(dto.getAccessTokenValiditySeconds()); + } + + if (dto.getRefreshTokenValiditySeconds() != null) { + client.setRefreshTokenValiditySeconds(dto.getRefreshTokenValiditySeconds()); + } + return client; }