Witam wszystkich, potrzebuje pomoc w zwiazku z potrzeba wyslania objektu dto podczas logowania. Do logowania uzywam tokenu jwt ktorego umieszczam w headerze, adres /api/login jest juz zajety :
.addFilterBefore(new JwtLoginFilter("/api/login", authenticationManager()), UsernamePasswordAuthenticationFilter.class)
skad przechodzi do
@Override protected void successfulAuthentication( HttpServletRequest req, HttpServletResponse res, FilterChain chain, Authentication auth) { UserDetails userDetails = (UserDetails) auth.getPrincipal(); String userRole = null; for (GrantedAuthority authority : userDetails.getAuthorities()) { userRole = authority.getAuthority(); if (!(userRole == null)) break; } String token = generateToken(auth.getName(), userRole); addTokenToResponse(res, token); }
Dlatego skoro nie posiadam tego w klasie ktora posiada adnotacje @RestController nie wiem jak dodac cos by bylo stworzone w body pod tym samym linkiem, zgaduje ze moze moglbym zrobic to w succesfullauthentication ale jak? jakies podpowiedzi :D?