Examples of UserAttributeEditor


Examples of org.springframework.security.userdetails.memory.UserAttributeEditor

    final String ua = config.getInitParameter("userAttribute");
    if(ua == null) {
      throw new Error("The init parameter 'userAttribute' must be declared");
    }
    final UserAttributeEditor uae = new UserAttributeEditor();
    uae.setAsText(ua);
    final UserAttribute userAttribute = (UserAttribute) uae.getValue();
    wrapped.setUserAttribute(userAttribute);
  }
View Full Code Here

Examples of org.springframework.security.userdetails.memory.UserAttributeEditor

  }

  public static UserRoleListEnhancedUserMap addUsersFromProperties( final UserRoleListEnhancedUserMap userMap,
      final Properties props ) {
    // Now we have properties, process each one individually
    UserAttributeEditor configAttribEd = new UserAttributeEditor();

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

      // 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 ) {
        UserDetails user =
View Full Code Here

Examples of org.springframework.security.userdetails.memory.UserAttributeEditor

     * @param users
     * @param props
     */
    TreeMap<String, User> loadUsersFromProperties(Properties props) {
        TreeMap<String, User> users = new TreeMap<String, User>();
        UserAttributeEditor configAttribEd = new UserAttributeEditor();

        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
            // the attribute editors parses the list of strings into password, username and enabled
            // flag
            String username = (String) iter.next();
            configAttribEd.setAsText(props.getProperty(username));

            // if the parsing succeeded turn that into a user object
            UserAttribute attr = (UserAttribute) configAttribEd.getValue();
            if (attr != null) {
                User user = createUserObject(username, attr.getPassword(), attr.isEnabled(), attr.getAuthorities());
                users.put(username, user);
            }
        }
View Full Code Here

Examples of org.springframework.security.userdetails.memory.UserAttributeEditor

  private void update() {
    try {
      if (myWatcher == null) {
      } else if (myWatcher.isStale()) {
  Properties prop = myWatcher.getProperties();
  UserAttributeEditor uae = new UserAttributeEditor();
  myDetailStorage.clear();

  Iterator it = prop.keySet().iterator();
  while  (it.hasNext()){
    String username = (String)it.next();
    uae.setAsText(prop.getProperty(username));
    UserAttribute attrs = (UserAttribute) uae.getValue();
    if (attrs != null) {
      myDetailStorage.put(username, makeUser(username, attrs));
    }
  }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.