Skip to content

Commit

Permalink
chore: added comments for send mail users fn
Browse files Browse the repository at this point in the history
  • Loading branch information
pierpaolodidato89 authored Oct 30, 2024
1 parent 07338b8 commit 84b05ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class AuthenticationPropagationHeadersFactory implements ClientHeadersFac
@Override
public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) {
String bearerToken;
// If user is founded on PDV, a bearer token is created starting from it
if (!clientOutgoingHeaders.isEmpty() && clientOutgoingHeaders.containsKey(USER_ID_HEADER)) {
final String uuid = clientOutgoingHeaders.get(USER_ID_HEADER).get(0);
final String jwt = tokenService.createJwt(uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ public void persistUsers(Onboarding onboarding) {
userRoleDto.setUserMailUuid(user.getUserMailUuid());
userRoleDto.setProduct(productMapper.toProduct(onboarding, user));
userRoleDto.getProduct().setTokenId(onboarding.getId());
/*
The second parameter (header param) of the following method is used to build a bearer token with which invoke the API
{@link it.pagopa.selfcare.onboarding.client.auth.AuthenticationPropagationHeadersFactory}
*/
try (Response response = userApi.usersUserIdPost(user.getId(), onboarding.getUserRequestUid(), userRoleDto)) {
if (!SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
throw new GenericOnboardingException("Impossible to create or update role for user with ID: " + user.getId());
Expand Down

0 comments on commit 84b05ee

Please sign in to comment.