public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { try { if (!NativeUtils.getInstance().checkUnixUser(username)) { throw new UsernameNotFoundException("No such Unix user: " + username); } } catch (NativeAccessException exc) { throw new DataAccessException("Failed to find Unix User", exc) { }; } // return some dummy instance return new User(username, "", true, true, true, true, new GrantedAuthority[]{AUTHENTICATED_AUTHORITY}); } };