skip to Main Content

Json – Extracting values from String array from JWT object in Java?

So I am getting my JWT token with SecurityContext like so: JwtAuthenticationToken authToken = (JWTAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); if (authToken != null) { log.warn("Principal authorities:"); authToken.getAuthorities().forEach(auth -> log.warn("authorities: [{}]", auth.getAuthority())); Map<String, Object> attributes = Collections.emptyMap(); attributes = authToken.getTokenAttributes(); with my token looking…

VIEW QUESTION

Json – Gson serialization fails without throwing errors

I have a pretty complex objects(I'm not posting the code because of that) I'm trying to serialize with these calls: Gson gson = new GsonBuilder().setPrettyPrinting().create(); PrintWriter output = new PrintWriter(new FileOutputStream("Hotels.json")); output.write(gson.toJson(myObject);); The program terminates with no failure but the…

VIEW QUESTION
Back To Top
Search