code: public String toLocal(Principal principal) {
          // This technically does not conform with rfc1964, but should work so
          // long as you don't have any really odd names in your KDC.
          return principal == null ? null : principal.getName().split("[/@]")[0];
      }
docs: Convert a Principal to a local user name.
  
  @param principal the principal to convert
  @return The local user name.