roles method

Sets the roles, written without ROLE_ (['ADMIN'] gives ROLE_ADMIN); replaces the default USER and earlier authorities.

Throws an ArgumentError for a role that starts with ROLE_.

Implementation

UserRequestPostProcessor roles(List<String> roles) {
  _authorities = User.withUsername('x').roles(roles).build().authorities;
  return this;
}