Package org.springframework.security.core.userdetails

Examples of org.springframework.security.core.userdetails.User$AuthorityComparator


    @Before
    public void setUp() throws Exception {
        callbackHandler = new SpringSecurityPasswordValidationCallbackHandler();

        grantedAuthority = new SimpleGrantedAuthority("ROLE_1");
        user = new User("Ernie", "Bert", true, true, true, true, Collections.singleton(grantedAuthority));

        WSUsernameTokenPrincipal principal = new WSUsernameTokenPrincipal("Ernie", true);
        callback = new UsernameTokenPrincipalCallback(principal);
    }
View Full Code Here


        verify(userDetailsService);
    }

    @Test
    public void testAuthenticateUserDigestValid() throws Exception {
        User user = new User(username, password, true, true, true, true, Collections.<GrantedAuthority>emptyList());
        expect(userDetailsService.loadUserByUsername(username)).andReturn(user);

        replay(userDetailsService);

        callbackHandler.handleInternal(callback);
View Full Code Here

        verify(userDetailsService);
    }

    @Test
    public void testAuthenticateUserDigestValidInvalid() throws Exception {
        User user = new User(username, "Big bird", true, true, true, true, Collections.<GrantedAuthority>emptyList());
        expect(userDetailsService.loadUserByUsername(username)).andReturn(user);

        replay(userDetailsService);

        callbackHandler.handleInternal(callback);
View Full Code Here

        verify(userDetailsService);
    }

    @Test
    public void testAuthenticateUserDigestDisabled() throws Exception {
        User user = new User(username, "Ernie", false, true, true, true, Collections.<GrantedAuthority>emptyList());
        expect(userDetailsService.loadUserByUsername(username)).andReturn(user);

        replay(userDetailsService);

        try {
View Full Code Here

      if (admins != null && admins.contains(username)) {
        authorities.add(ROLE_ADMIN);
      }

      // TODO: this should really be our own UserDetails wrapper class, shouldn't it?
      User user = new User(userInfo.getSub(), password, authorities);
      return user;
    } else {
      throw new UsernameNotFoundException("Could not find username: " + username);
    }
  }
View Full Code Here

        List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        for (Entitlement entitlement : entitlementDAO.findAll()) {
            authorities.add(new SimpleGrantedAuthority(entitlement.getName()));
        }

        UserDetails userDetails = new User(adminUser, "FAKE_PASSWORD", true, true, true, true, authorities);
        Authentication authentication = new TestingAuthenticationToken(userDetails, "FAKE_PASSWORD", authorities);
        SecurityContextHolder.getContext().setAuthentication(authentication);
    }
View Full Code Here

            Reader reader = readerDAO.findReaderByEmail(email);
            if (reader == null){throw new UsernameNotFoundException("Username Not Found");}
            pass = reader.getPassword();
            authList.add(new GrantedAuthorityImpl("ROLE_READER"));   
        }
         return new User(email, pass, true, true, true, true, authList);


       
    }   
View Full Code Here

//        if (!usernameBasedPrimaryKey) {
//            returnUsername = username;
//        }

        return new User(returnUsername, userFromUserQuery.getPassword(), userFromUserQuery.isEnabled(),
                true, true, true, combinedAuthorities);
    }
View Full Code Here

  @Override
  public void changePassword(String username, String password) {
    // TODO Auto-generated method stub
      // get the UserDetails
      User userDetails =
          (User) getUserMap().getUser(username);
      // create a new UserDetails with the new password
      User newUserDetails =
          new User(userDetails.getUsername(),password,
          userDetails.isEnabled(),
          userDetails.isAccountNonExpired(),
        userDetails.isCredentialsNonExpired(),
          userDetails.isAccountNonLocked(),
          userDetails.getAuthorities());
View Full Code Here

  }

  @Override
  public void changePassword(String username, String oldpass, String newpass) {
    // TODO Auto-generated method stub
      User userDetails =
          (User) getUserMap().getUser(username);
      // create a new UserDetails with the new password
      User newUserDetails =
          new User(userDetails.getUsername(),newpass,
          userDetails.isEnabled(),
          userDetails.isAccountNonExpired(),
        userDetails.isCredentialsNonExpired(),
          userDetails.isAccountNonLocked(),
          userDetails.getAuthorities());
View Full Code Here

TOP

Related Classes of org.springframework.security.core.userdetails.User$AuthorityComparator

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.