Package org.acegisecurity.userdetails

Examples of org.acegisecurity.userdetails.UsernameNotFoundException


            throws UsernameNotFoundException, DataAccessException {

      SecurityService service = ServiceLocator.instance().getSecurityService();
        UserDetailsVO userDetailsVO = service.getUserDetails(username);
        if (userDetailsVO == null) {
            throw new UsernameNotFoundException("User " + username + " not found");
        }
        return new UserDetailsImpl(userDetailsVO);
    }
View Full Code Here


                return new org.acegisecurity.userdetails.User(username,"",true,true,true,true,new GrantedAuthority[]{AUTHENTICATED_AUTHORITY});
            }

            @Override
            public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
                throw new UsernameNotFoundException(groupname);
            }
        };
    }
View Full Code Here

  }

  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    List users = usersByUsernameMapping.execute(username);
    if (users.size() == 0)
      throw new UsernameNotFoundException("User not found");
    UserDetails user = (UserDetails) users.get(0);
    List dbAuths = this.customAuthoritiesByUsernameMapping.execute(new Object[]{user.getUsername(),user.getUsername(),user.getUsername()});
    addCustomAuthorities(user.getUsername(), dbAuths);
    //if (dbAuths.size() == 0)
    //  throw new UsernameNotFoundException("User has no GrantedAuthority");
View Full Code Here

    /**
     * This implementation doesn't support groups.
     */
    @Override
    public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
        throw new UsernameNotFoundException(groupname);
    }
View Full Code Here

    @Override
    public Details loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        User u = User.get(username,false);
        Details p = u!=null ? u.getProperty(Details.class) : null;
        if(p==null)
            throw new UsernameNotFoundException("Password is not set: "+username);
        if(p.getUser()==null)
            throw new AssertionError();
        return p;
    }
View Full Code Here

    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
        if(!UnixUser.exists(username))
            throw new UsernameNotFoundException("No such Unix user: "+username);
        try {
            UnixUser uu = new UnixUser(username);
            // return some dummy instance
            return new User(username,"",true,true,true,true, toAuthorities(uu));
        } catch (PAMException e) {
            throw new UsernameNotFoundException("Failed to load information about Unix user "+username,e);
        }
    }
View Full Code Here

            group = groupname.substring(1);
        } else {
            group = groupname;
        }
        if(CLibrary.libc.getgrnam(group)==null)
            throw new UsernameNotFoundException(group);
        return new GroupDetails() {
            @Override
            public String getName() {
                return group;
            }
View Full Code Here

                return new org.acegisecurity.userdetails.User(username,"",true,true,true,true,new GrantedAuthority[]{AUTHENTICATED_AUTHORITY});
            }

            @Override
            public GroupDetails loadGroupByGroupname(String groupname) throws UsernameNotFoundException, DataAccessException {
                throw new UsernameNotFoundException(groupname);
            }
        };
    }
View Full Code Here

        } catch (WebloggerException ex) {
            throw new DataRetrievalFailureException("ERROR in user lookup", ex);
        }
       
        if (userData == null) {
            throw new UsernameNotFoundException("ERROR no user: " + userName);
        }
       
        GrantedAuthority[] authorities =
            new GrantedAuthorityImpl[userData.getRoles().size()];
        int i = 0;
View Full Code Here

        if (defaultRole != null) {
            authorities[roleCount-1] = defaultRole;
        }

        if (authorities.length == 0) {
            throw new UsernameNotFoundException("User has no GrantedAuthority");
        }

        return authorities;
    }
View Full Code Here

TOP

Related Classes of org.acegisecurity.userdetails.UsernameNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.