class DefaultAuthenticationService implements AuthenticationService {

    @Override
    public String authenticationToken(final String username, final String password) {
        final UserEntity userEntity = userService.findByName(username);
        final DateTime now = dateTimeService.now();

        return Jwts.builder()
            .setSubject(userEntity.getName())
            .setId(userEntity.getId().toString())
            .claim("roles", userEntity.getRoleEntities())
            .setIssuedAt(now.toLocalDateTime().toDate())
            .setExpiration(dateTimeService.plusDaysAsDate(now, TOKEN_INTERVAL_DAYS))
            .signWith(SignatureAlgorithm.HS256, JwtFilter.SECRET_KEY)
            .compact();
    }

    @Autowired public  DefaultAuthenticationService(final UserService userService, final DateTimeService dateTimeService);

}