@Test public void testPrincipalNames() { UserStore users = new UserStore(); users.addUser(TEST_USER, SecurityUtils.NO_CREDENTIAL, new String[] { DefaultRoleSecurityProvider.ADMIN }); UserStoreAuthorizationService usas = new SpnegoUserStoreAuthorizationService(users); UserIdentity result = usas.getUserIdentity(null, TEST_USER + "/host@REALM"); assertNotNull(result); assertEquals(TEST_USER, result.getUserPrincipal().getName()); result = usas.getUserIdentity(null, TEST_USER + "@REALM"); assertNotNull(result); assertEquals(TEST_USER, result.getUserPrincipal().getName()); result = usas.getUserIdentity(null, TEST_USER + "/host"); assertNotNull(result); assertEquals(TEST_USER, result.getUserPrincipal().getName()); result = usas.getUserIdentity(null, TEST_USER); assertNotNull(result); assertEquals(TEST_USER, result.getUserPrincipal().getName()); }
@Override public UserIdentity getUserIdentity(HttpServletRequest request, String name) { int hostSeparator = name.indexOf('/'); String shortName = hostSeparator > 0 ? name.substring(0, hostSeparator) : name; int realmSeparator = shortName.indexOf('@'); shortName = realmSeparator > 0 ? shortName.substring(0, realmSeparator) : shortName; return super.getUserIdentity(request, shortName); }
SpnegoUserStoreAuthorizationService extends UserStoreAuthorizationService { @Override public UserIdentity getUserIdentity(HttpServletRequest request, String name) { int hostSeparator = name.indexOf('/'); String shortName = hostSeparator > 0 ? name.substring(0, hostSeparator) : name; int realmSeparator = shortName.indexOf('@'); shortName = realmSeparator > 0 ? shortName.substring(0, realmSeparator) : shortName; return super.getUserIdentity(request, shortName); } }
SpnegoUserStoreAuthorizationService extends UserStoreAuthorizationService { @Override public UserIdentity getUserIdentity(HttpServletRequest request, String name) { int hostSeparator = name.indexOf('/'); String shortName = hostSeparator > 0 ? name.substring(0, hostSeparator) : name; int realmSeparator = shortName.indexOf('@'); shortName = realmSeparator > 0 ? shortName.substring(0, realmSeparator) : shortName; return super.getUserIdentity(request, shortName); } SpnegoUserStoreAuthorizationService(String privilegesFilePath);  SpnegoUserStoreAuthorizationService(UserStore userStore); }
SpnegoUserStoreAuthorizationService extends UserStoreAuthorizationService { @Override public UserIdentity getUserIdentity(HttpServletRequest request, String name) { int hostSeparator = name.indexOf('/'); String shortName = hostSeparator > 0 ? name.substring(0, hostSeparator) : name; int realmSeparator = shortName.indexOf('@'); shortName = realmSeparator > 0 ? shortName.substring(0, realmSeparator) : shortName; return super.getUserIdentity(request, shortName); } SpnegoUserStoreAuthorizationService(String privilegesFilePath);  SpnegoUserStoreAuthorizationService(UserStore userStore); @Override UserIdentity getUserIdentity(HttpServletRequest request, String name); }
SpnegoUserStoreAuthorizationService extends UserStoreAuthorizationService { @Override public UserIdentity getUserIdentity(HttpServletRequest request, String name) { int hostSeparator = name.indexOf('/'); String shortName = hostSeparator > 0 ? name.substring(0, hostSeparator) : name; int realmSeparator = shortName.indexOf('@'); shortName = realmSeparator > 0 ? shortName.substring(0, realmSeparator) : shortName; return super.getUserIdentity(request, shortName); } SpnegoUserStoreAuthorizationService(String privilegesFilePath);  SpnegoUserStoreAuthorizationService(UserStore userStore); @Override UserIdentity getUserIdentity(HttpServletRequest request, String name);  }