Package org.springframework.security.core.userdetails

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


    public UserDetailsManagerCollectionAspect getAspect() {
        return UserDetailsManagerCollectionAspect.aspectOf();
    }

    private User createUser(String username) {
        return new User(username, UUID.randomUUID().toString(),
                true, true, true, true,
                AuthorityUtils.createAuthorityList(String.valueOf(System.nanoTime())));
    }
View Full Code Here


      accountId = (Integer)account.get("accountid");
    }
   
   
 
    User user = new CustomUser(accountProfile.getUserid(), accountProfile.getPasswd(), getAuthorities(accountProfile.getUserid()), accountId, accountProfile.getProfileid(), token);
    if (log.isDebugEnabled()) {
      log.debug("UserDetailsServiceImpl.loadUserByUsername(): user=" + user  + " username::token" + token);
    }
   
    return user;
View Full Code Here

        SAMLAuthenticationToken token = new SAMLAuthenticationToken(context);
        SAMLCredential result = new SAMLCredential(nameID, assertion, "IDP", "localSP");

        expect(consumer.processAuthenticationResponse(context)).andReturn(result);
        expect(assertion.getAuthnStatements()).andReturn(new LinkedList<AuthnStatement>());
        User user = new User("test", "test", true, true, true, true, Arrays.asList(new SimpleGrantedAuthority("role1"), new SimpleGrantedAuthority("role2")));
        expect(details.loadUserBySAML(result)).andReturn(user);

        provider.setForcePrincipalAsString(false);

        replayMock();
        replay(details);
        Authentication authentication = provider.authenticate(token);
        assertEquals(user, authentication.getPrincipal());
        assertEquals(user.getUsername(), authentication.getName());
        assertNotNull(authentication.getDetails());
        assertEquals(2, authentication.getAuthorities().size());
        assertTrue(authentication.getAuthorities().contains(new SimpleGrantedAuthority("role1")));
        assertTrue(authentication.getAuthorities().contains(new SimpleGrantedAuthority("role2")));
        verify(details);
View Full Code Here

    ClientDetails clientDetails = clientDetailsService.loadClientByClientId(username);
    String clientSecret = clientDetails.getClientSecret();
    if (clientSecret== null || clientSecret.trim().length()==0) {
      clientSecret = emptyPassword;
    }
    return new User(username, clientSecret, clientDetails.getAuthorities());
  }
View Full Code Here

         * The only important parameter in User's constructor is "loginName",
         * which corresponds to the "username" property if the "saltSource" is
         * "ReflectionSaltSource". Note that "SystemWideSaltSource" ignores
         * the "user" passed as a parameter to "saltSource.getSalt".
         */
        UserDetails userDetails = new User(loginName, clearPassword, true,
                true, true, true, Collections.<GrantedAuthority>emptyList());

        Object salt = null;

        if (saltSource != null) {
View Full Code Here

    if(customer == null) {
      return null;
    }
    List<Role> roles = customer.getRoles();
    Role role = roles.get(0);
    return new User(customer.getLogin(), customer.getPassword(), customer.isActive(), true, true, true, getAuthorities(role.getRoleInt()));
  }
View Full Code Here

    if (authentication != null) {
      Object principal = authentication.getPrincipal();
      if (principal instanceof UserDetails) {
        Customer customer = null;
        try {
          User user = (User) principal;
          customer = find(user.getUsername());
          log.info("Customer found in cookie!!!");
        } catch(Exception exc) {
          log.error("Cannot cast customer:", exc);
        }
        if(customer == null) {
View Full Code Here

     *
     * @param token the authentication request token
     * @param authorities the pre-authenticated authorities.
     */
    protected UserDetails createuserDetails(Authentication token, List<GrantedAuthority> authorities) {
        return new User(token.getName(), "N/A", true, true, true, true, authorities);
    }
View Full Code Here

                grantedAuthorities.add(new GrantedAuthorityImpl(this.convertToUpperCase ? value.toString().toUpperCase() : value.toString()));
            }

        }

        return new User(assertion.getPrincipal().getName(), NON_EXISTENT_PASSWORD_VALUE, true, true, true, true, grantedAuthorities);
    }
View Full Code Here

            UserAttribute attr = (UserAttribute) configAttribEd.getValue();

            // Make a user object, assuming the properties were properly provided
            if (attr != null) {
                UserDetails user = new User(username, attr.getPassword(), attr.isEnabled(), true, true, true,
                        attr.getAuthorities());
                userMap.addUser(user);
            }
        }
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.