View Javadoc

1   /*
2    * GenerateOsgUserVoMap.java
3    *
4    * Created on June 9, 2004, 1:44 PM
5    */
6   package gov.bnl.gums.admin;
7   
8   import gov.bnl.gums.configuration.Configuration;
9   
10  /**
11   * @author Gabriele Carcassi, Jay Packard
12   */
13  public class GenerateFqanMapFile extends GenerateMap {
14      static {
15          command = new GenerateFqanMapFile();
16      }
17  
18      /**
19       * Creates a new GenerateOsgUserVoMap object.
20       */
21      public GenerateFqanMapFile() {
22          syntax = "[-g GUMSURL] [-f FILENAME] [SERVICEDN]";
23          description = "Generates the FQAN-mapfile for a service/host.";
24  //            "When using ./bin/gums, SERVICEDN must be specified. " +
25  //            "When using ./bin/gums-host, SERVICEDN defaults to the host certificate DN.";
26      }
27  
28      protected String generateMap(String hostname, String gumsUrl) throws Exception {
29          String map = null;
30          map = getGums(gumsUrl).generateFqanMapfile(hostname);
31          if (map == null) {
32              System.err.println("Could not create FQAN-mapfile.");
33     			System.out.print("The GUMS server configuration may not be correct.  ");
34     			System.out.print("Please contact your administrator, or if you are the administrator, make sure you have the following elements in your gums.config (which can be easily configured from the web interface):\n");
35     			System.out.print("\t1) A hostToGroupMapping element which matches the requesting host name: "+hostname+"\n");
36     			System.out.print("\t2) A groupToAccountMapping (referenced by the hostToGroupMapping) element which contains a user group and account mapper\n");
37     			System.out.print("\t3) A userGroup element (referenced by the groupToAccountMapping) to validate membership of the requested DN\n");
38     			System.out.print("\t4) A accountMapper element (referenced by the groupToAccountMapping) to return the account for the requested DN\n");
39              System.exit(-1);
40          }
41          return map;
42      }
43  }