Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2007 - 2008 Pentaho Corporation.  All rights reserved.
  * This software was developed by Pentaho Corporation and is provided under the terms
  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
  * this file except in compliance with the license. If you need a copy of the license,
  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
  * BI Platform.  The Initial Developer is Pentaho Corporation.
  *
  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to
 * the license for the specific language governing your rights and limitations.
 */
package org.pentaho.platform.plugin.services.security.userrole.memory;
Takes as input the string that defines a UserMap. When Spring instantiates this bean, it outputs a UserMap.

This class allows a string that defines a UserMap to be defined once in Spring beans XML, then used by multiple client beans that need access to user to role mappings.

This class is necessary since UserMap does not define a constructor or setter necessary to populate a UserMap bean, nor does it provide any way to extract its mappings once created.

Example usage:

     <bean id="userMap" class="java.lang.String">
       <constructor-arg type="java.lang.String">
         <value>
           <![CDATA[
           joe=password,Admin,ceo,Authenticated
           ...
           ]]>
         </value>
       </constructor-arg>
     </bean>

     <bean id="userMapFactoryBean"
       class="org.pentaho.security.UserMapFactoryBean">
       <property name="userMap" ref="userMap" />
     </bean>

     <bean id="memoryAuthenticationDao"
       class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
       <property name="userMap" ref="userMapFactoryBean" />
     </bean>
 

Author(s):
mlowery
See also:
UserRoleListEnhancedUserMapFactoryBean
public class UserMapFactoryBean implements FactoryBean {
  /*
   * The user map text which will be processed by property editor.
   */
  private String userMap;
  public Object getObject() throws Exception {
    UserMapEditor userMapEditor = new UserMapEditor();
    userMapEditor.setAsText();
    return userMapEditor.getValue();
  }
  public Class getObjectType() {
    return UserMap.class;
  }
  public boolean isSingleton() {
    return true;
  }
  public void setUserMap(final String userMap) {
    this. = userMap;
  }
New to GrepCode? Check out our FAQ X