@Override
  public String getPrincipal() {
    Subject subject = org.apache.shiro.SecurityUtils.getSubject();

    String principal;
    if (subject.isAuthenticated()) {
      principal = extractPrincipal(subject);
      if (zConf.isUsernameForceLowerCase()) {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("Converting principal name {} to lower case: {}", principal, principal.toLowerCase());
        }
        principal = principal.toLowerCase();
      }
    } else {
      // TODO(jl): Could be better to occur error?
      principal = "anonymous";
    }
    return principal;
  }
@Test
  void testUsernameForceLowerCase() throws IOException, InterruptedException {
    String expectedName = "java.security.Principal.getName()";
    when(zConf.isUsernameForceLowerCase()).thenReturn(true);
    setupPrincipalName(expectedName);
    assertEquals(expectedName.toLowerCase(), shiroSecurityService.getPrincipal());
  }