code:     public String[] getRoles(Principal principal) {
          if (principal instanceof GenericPrincipal) {
              return ((GenericPrincipal) principal).getRoles();
          }
  
          String className = principal.getClass().getSimpleName();
          throw new IllegalStateException(sm.getString("realmBase.cannotGetRoles", className));
      }
  