Jwt Role Based Authorization - Spring Security

I am a beginner in Spring Boot and trying to implement Jwt Role Based Authorization. For this, I followed this tutorial

https://www.devglan.com/spring-security/jwt-role-based-authorization

I have been able to understand most of the code but there is this one method that I cant seem to figure out its purpose. The first three lines of code are used for validating the token but what is the purpose of getauthentication method. What is this jwt parser and claims doing?

TokenProvider.java:

 public Boolean validateToken(String token, UserDetails userDetails) {
    final String username = getUsernameFromToken(token);
    return (
          username.equals(userDetails.getUsername())
                && !isTokenExpired(token));
 }

UsernamePasswordAuthenticationToken getAuthentication(final String token, final Authentication 
    existingAuth, final UserDetails userDetails) {

    final JwtParser jwtParser = Jwts.parser().setSigningKey(SIGNING_KEY);

    final Jws<Claims> claimsJws = jwtParser.parseClaimsJws(token);

    final Claims claims = claimsJws.getBody();

    final Collection<? extends GrantedAuthority> authorities =
            Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(","))
                    .map(SimpleGrantedAuthority::new)
                    .collect(Collectors.toList());

    return new UsernamePasswordAuthenticationToken(userDetails, "", authorities);
   }

If anyone can explain these lines of code to me step by step It would mean alot. Thanks.