The answer is messy.
First you need to find out what type request.getUserPrincipal() returns in your webapp.
System.out.println("type = " + request.getUserPrincipal().getClass());
Let's say that returns org.apache.catalina.realm.GenericPrincipal.
Then cast the result of getUserPrincipal() to that type and use the methods it provides.
final Principal userPrincipal = request.getUserPrincipal();
GenericPrincipal genericPrincipal = (GenericPrincipal) userPrincipal;
final String[] roles = genericPrincipal.getRoles();
I said it was going to be messy. It's not very portable either.