@Test void testVerifyAuthentication() { var service = this.engine.getService(AuthenticationService.class); var user = new User("user", "mypass"); user.setRoles(List.of(ROLE_ADMIN)); PersistenceManager.getInstance().persist(user); var token = service.createToken(user); assertNotNull(token); var decodedUser = service.verifyToken(token); assertEquals(user, decodedUser); var ctx = new UserContext(decodedUser, false); assertEquals(user, ctx.getUserPrincipal()); assertTrue(ctx.isUserInRole(ROLE_ADMIN)); }
public void setRoles(List<String> roles) { this.roles = roles; }
User implements Principal, PersistentObject<String> { public void setRoles(List<String> roles) { this.roles = roles; } }
User implements Principal, PersistentObject<String> { public void setRoles(List<String> roles) { this.roles = roles; } User();  User(String username);  User(String username, String password); }
User implements Principal, PersistentObject<String> { public void setRoles(List<String> roles) { this.roles = roles; } User();  User(String username);  User(String username, String password); @Override boolean equals(Object o); @Override int hashCode(); String getUsername(); void setUsername(String username); String getPassword(); void setPassword(String password); @Override @JsonIgnore String getName(); @Override String getId(); void setRoles(List<String> roles); boolean hasRole(String role); boolean isShadow(); void setShadow(boolean shadow); String getFullName(); void setEmail(String email); void setFullName(String fullName); String getEmail(); }
User implements Principal, PersistentObject<String> { public void setRoles(List<String> roles) { this.roles = roles; } User();  User(String username);  User(String username, String password); @Override boolean equals(Object o); @Override int hashCode(); String getUsername(); void setUsername(String username); String getPassword(); void setPassword(String password); @Override @JsonIgnore String getName(); @Override String getId(); void setRoles(List<String> roles); boolean hasRole(String role); boolean isShadow(); void setShadow(boolean shadow); String getFullName(); void setEmail(String email); void setFullName(String fullName); String getEmail();  }