Java 类org.springframework.security.core.userdetails.memory.UserAttributeEditor 实例源码

项目:artsholland-platform    文件:ApiUserDetailsService.java   
@Override
public UserDetails loadUserByUsername(String apiKey)
        throws UsernameNotFoundException {
    String userPropsValue = userProperties.getProperty(apiKey);

    if (userPropsValue == null) {
        throw new UsernameNotFoundException(apiKey);
    }

    UserAttributeEditor configAttribEd = new UserAttributeEditor();
    configAttribEd.setAsText(userPropsValue);
    UserAttribute userAttributes = (UserAttribute) configAttribEd.getValue(); 

    UserDetails user = new User(apiKey, 
            userAttributes.getPassword(), 
            userAttributes.isEnabled(), 
            true, 
            true, 
            true, 
            userAttributes.getAuthorities());
    return user;
}
项目:incubator-taverna-server    文件:UserStore.java   
public void setBaselineUserProperties(Properties props) {
    UserAttributeEditor parser = new UserAttributeEditor();

    for (Object name : props.keySet()) {
        String username = (String) name;
        String value = props.getProperty(username);

        // Convert value to a password, enabled setting, and list of granted
        // authorities
        parser.setAsText(value);

        UserAttribute attr = (UserAttribute) parser.getValue();
        if (attr != null && attr.isEnabled())
            base.put(username, new BootstrapUserInfo(username, attr));
    }
}
项目:eHMP    文件:VistaUserMapEditor.java   
public static VistaUserMap addUsersFromProperties(VistaUserMap userMap, Properties props) {
    // Now we have properties, process each one individually
    UserAttributeEditor configAttribEd = new UserAttributeEditor();

    for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
        String key = (String) iter.next();
        String value = props.getProperty(key);

        // Convert value to a password, enabled setting, and list of granted authorities
        configAttribEd.setAsText(value);

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

        // Make a user object, assuming the properties were properly provided
        if (attr != null) {
            String duz = StringUtils.split(key, "@")[0];
            String stationNumber = StringUtils.split(key, "@")[1];
            String access = StringUtils.split(attr.getPassword(), ";")[0];
            String verify = StringUtils.split(attr.getPassword(), ";")[1];
            VistaUserDetails user = new VistaUser(new RpcHost("localhost"), new Random().toString(), stationNumber, stationNumber, duz, verify, "foobar", attr.isEnabled(), true, true, true, attr.getAuthorities());
            userMap.addUser(user);
        }
    }

    return userMap;
}
项目:pentaho-osgi-bundles    文件:UserDetailsServiceImpl.java   
public UserDetailsServiceImpl( ITenantedPrincipleNameResolver tenantedPrincipleNameResolver,
    Map<String, String> userDefMap ) {
  this.tenantedPrincipleNameResolver = tenantedPrincipleNameResolver;

  for ( String username : userDefMap.keySet() ) {

    UserAttributeEditor userAttributeEditor = new UserAttributeEditor();
    userAttributeEditor.setAsText( userDefMap.get( username ) );
    userDetailsList.put( username, new UserDetailsImpl( username, (UserAttribute) userAttributeEditor
        .getValue() ) );
  }
}