Java 8 UserPrincipal - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 UserPrincipal class.

This code example shows how to use the following methods:getName
    StringTransformer transformer = StringTransformers.caseInsensitive(Locale.US);
    UserPrincipalLookupService lookupService = new MemoryUserPrincipalLookupService(users, groups, transformer,
            new ClosedFileSystemChecker()); 
 
    UserPrincipal user = lookupService.lookupPrincipalByName("user");
    assertEquals("usEr", user.getName());
    assertEquals(user,lookupService.lookupPrincipalByName("USER"));
 
    try { 
      lookupService.lookupPrincipalByName("group");
      fail("lookup should fail"); 
    } catch (UserPrincipalNotFoundException e) {
      assertEquals("group", e.getName());
    } 
 
    UserPrincipal group = lookupService.lookupPrincipalByGroupName("group");
    assertEquals("grOup", group.getName());
    assertEquals(group,lookupService.lookupPrincipalByGroupName("GROUP"));
 
    try { 
3
CodeRank
This code example shows how to use the following methods:getName
See Code Examples for Java 8 UserPrincipal Methods: