Skip to content

Commit

Permalink
LPD-47069 Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
MarinhoFeliphe authored and brianchandotcom committed Jan 27, 2025
1 parent ac8dd62 commit 4173ea4
Showing 1 changed file with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
package com.liferay.sample;

import com.liferay.client.extension.util.spring.boot.BaseRestController;
import com.liferay.petra.string.StringBundler;

import org.json.JSONObject;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;

/**
* @author Raymond Augé
Expand All @@ -45,28 +41,15 @@ public ResponseEntity<String> post(
}

return new ResponseEntity<>(
WebClient.create(
StringBundler.concat(
lxcDXPServerProtocol, "://", lxcDXPMainDomain,
"/o/headless-admin-user/v1.0/user-accounts/",
modelDTOAccountJSONObject.getLong("id"))
).patch(
).accept(
MediaType.APPLICATION_JSON
).contentType(
MediaType.APPLICATION_JSON
).bodyValue(
patch(
"Bearer " + jwt.getTokenValue(),
new JSONObject(
).put(
"alternateName",
modelDTOAccountJSONObject.getString("givenName")
).toString()
).header(
HttpHeaders.AUTHORIZATION, "Bearer " + jwt.getTokenValue()
).retrieve(
).bodyToMono(
String.class
).block(),
).toString(),
"/o/headless-admin-user/v1.0/user-accounts/" +
modelDTOAccountJSONObject.getLong("id")),
HttpStatus.OK);
}

Expand Down

0 comments on commit 4173ea4

Please sign in to comment.