@Test public void testLogin() throws Exception { SecuritySystem securitySystem = this.getSecuritySystem(); UsernamePasswordToken token = new UsernamePasswordToken("jcoder", "jcoder"); Subject subject = securitySystem.getSubject(); Assert.assertNotNull(subject); subject.login(token); try { subject.login(new UsernamePasswordToken("jcoder", "INVALID")); fail("expected AuthenticationException"); } catch (AuthenticationException e) { } }
@Override public Subject getSubject() { return SecurityUtils.getSubject(); }
DefaultSecuritySystem extends StateGuardLifecycleSupport implements SecuritySystem { @Override public Subject getSubject() { return SecurityUtils.getSubject(); } }
DefaultSecuritySystem extends StateGuardLifecycleSupport implements SecuritySystem { @Override public Subject getSubject() { return SecurityUtils.getSubject(); } @Inject  DefaultSecuritySystem(final EventManager eventManager,
                               final RealmSecurityManager realmSecurityManager,
                               final RealmManager realmManager,
                               final AnonymousManager anonymousManager,
                               final Map<String, AuthorizationManager> authorizationManagers,
                               final Map<String, UserManager> userManagers,
                               final SecurityHelper securityHelper); }
DefaultSecuritySystem extends StateGuardLifecycleSupport implements SecuritySystem { @Override public Subject getSubject() { return SecurityUtils.getSubject(); } @Inject  DefaultSecuritySystem(final EventManager eventManager,
                               final RealmSecurityManager realmSecurityManager,
                               final RealmManager realmManager,
                               final AnonymousManager anonymousManager,
                               final Map<String, AuthorizationManager> authorizationManagers,
                               final Map<String, UserManager> userManagers,
                               final SecurityHelper securityHelper); @Override Subject getSubject(); @Override boolean isPermitted(PrincipalCollection principal, String permission); @Override boolean[] isPermitted(PrincipalCollection principal, List<String> permissions); @Override void checkPermission(PrincipalCollection principal, String permission); @Override Set<Role> listRoles(); @Override Set<Role> listRoles(String sourceId); @Override Set<Privilege> listPrivileges(); @Override User addUser(User user, String password); @Override User updateUser(User user); @Override void deleteUser(String userId); @Override void deleteUser(String userId, String source); @Override void setUsersRoles(String userId, String source, Set<RoleIdentifier> roleIdentifiers); @Override @Nullable User currentUser(); @Override User getUser(String userId); @Override User getUser(String userId, String source); @Override Set<User> listUsers(); @Override Set<User> searchUsers(UserSearchCriteria criteria); @Override AuthorizationManager getAuthorizationManager(String source); @Override void changePassword(String userId, String oldPassword, String newPassword); @Override void changePassword(String userId, String newPassword); @Override void changePassword(String userId, String newPassword, boolean clearCache); void requirePermissionToChangeUserPassword(final String userId); boolean isPermittedToChangeUserPassword(final String userId); @Override UserManager getUserManager(final String source); @Override List<String> listSources(); }
DefaultSecuritySystem extends StateGuardLifecycleSupport implements SecuritySystem { @Override public Subject getSubject() { return SecurityUtils.getSubject(); } @Inject  DefaultSecuritySystem(final EventManager eventManager,
                               final RealmSecurityManager realmSecurityManager,
                               final RealmManager realmManager,
                               final AnonymousManager anonymousManager,
                               final Map<String, AuthorizationManager> authorizationManagers,
                               final Map<String, UserManager> userManagers,
                               final SecurityHelper securityHelper); @Override Subject getSubject(); @Override boolean isPermitted(PrincipalCollection principal, String permission); @Override boolean[] isPermitted(PrincipalCollection principal, List<String> permissions); @Override void checkPermission(PrincipalCollection principal, String permission); @Override Set<Role> listRoles(); @Override Set<Role> listRoles(String sourceId); @Override Set<Privilege> listPrivileges(); @Override User addUser(User user, String password); @Override User updateUser(User user); @Override void deleteUser(String userId); @Override void deleteUser(String userId, String source); @Override void setUsersRoles(String userId, String source, Set<RoleIdentifier> roleIdentifiers); @Override @Nullable User currentUser(); @Override User getUser(String userId); @Override User getUser(String userId, String source); @Override Set<User> listUsers(); @Override Set<User> searchUsers(UserSearchCriteria criteria); @Override AuthorizationManager getAuthorizationManager(String source); @Override void changePassword(String userId, String oldPassword, String newPassword); @Override void changePassword(String userId, String newPassword); @Override void changePassword(String userId, String newPassword, boolean clearCache); void requirePermissionToChangeUserPassword(final String userId); boolean isPermittedToChangeUserPassword(final String userId); @Override UserManager getUserManager(final String source); @Override List<String> listSources();  }