Skip to content
Snippets Groups Projects
Commit 988f0306 authored by Martin Gargalovič's avatar Martin Gargalovič
Browse files

fixed ConfidentialClientApplication

parent 5e7948e9
No related branches found
No related tags found
1 merge request!44fixed ConfidentialClientApplication
Pipeline #
......@@ -57,12 +57,6 @@ public class ConfidentialClientApplication {
public void onAuthenticationSuccess(HttpServletRequest req, HttpServletResponse res, Authentication auth) throws ServletException, IOException {
var a= res.getHeaderNames();
for (var name : a) {
System.out.println(res.getHeader(name));
}
System.out.println("got here");
if (auth instanceof OAuth2AuthenticationToken token
&& token.getPrincipal() instanceof OidcUser user) {
var createDto = new UserCreateDto();
......@@ -71,13 +65,16 @@ public class ConfidentialClientApplication {
createDto.setEmail(user.getEmail());
createDto.setUsername(user.getPreferredUsername());
//var result = WebClient.builder().baseUrl("http://localhost:8081/users/register").build().post()
//.contentType(MediaType.APPLICATION_JSON).body(BodyInserters.fromValue(createDto))
//.retrieve();
var result = WebClient.builder().baseUrl("http://localhost:8081/users/register").build().post()
.contentType(MediaType.APPLICATION_JSON).body(BodyInserters.fromValue(createDto))
.retrieve();
//var out = result.bodyToMono(UserDto.class).block();
//System.out.println(out);
try {
result.bodyToMono(UserDto.class).block();
} catch (Exception e) {
System.out.println("unable to save user");
}
}
super.onAuthenticationSuccess(req, res, auth);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment