currentAuthentication Role understanding

Hi,

My requirement is while login if user had multiple specific role i want you to select that role and proceed with the access provide to that user.

With the help of Below code i am able get one role but on what basis it fetch get(0) position role.
and also is it possible to set get(0) role and menu visible on user selection if user has multiple roles.

currentAuthentication.getUser().getAuthorities().stream().findFirst().get().getAuthority();

You can to use Specific Policy - Resource Roles :: Jmix Documentation