View Javadoc

1   /*
2    * GroupAccountMapper.java
3    *
4    * Created on May 25, 2004, 2:10 PM
5    */
6   
7   package gov.bnl.gums;
8   
9   import org.apache.commons.logging.Log;
10  import org.apache.commons.logging.LogFactory;
11  
12  /*** An account mapping policy that maps all user to the same account.
13   * <p>
14   * To configure the policy one needs only to set the groupName property
15   * as the desired group account.
16   *
17   * @author  Gabriele Carcassi
18   */
19  public class GroupAccountMapper implements AccountMapper {
20      private Log log = LogFactory.getLog(GroupAccountMapper.class);
21      
22      private String groupName;
23      
24      public String mapUser(String userDN) {
25          
26          if (log.isDebugEnabled()) {
27              log.debug("User " + userDN + " mapped to account " + groupName);
28          }
29          
30          return groupName;
31      }
32      
33      /***
34       * Changes the group account name returned by the mapper.
35       * @param groupName a username (i.e. 'atlas')
36       */
37      public void setGroupName(String groupName) {
38          log.debug("GroupName changed from  " + this.groupName + " to " + groupName);
39          this.groupName = groupName;
40      }
41      
42      /***
43       * Returns the group account name used by the mapper.
44       * @return a username (i.e. 'atlas')
45       */
46      public String getGroupName() {
47          return groupName;
48      }
49  }