Username Transformations

As of version 1.1.1, OA4MP has a facility for transforming the username sent to the MyProxy server. This functionality is similar for the OAuth 2.0 version as well. This is a special feature that is only needed in specific cases, such as in a Shibboleth environment. What happens is that immediately before the call to a MyProxy server, a single method is invoked (which you write) that takes the HTTP request and the current username. The returned value is the username which will be sent to MyProxy. In the case of Shibboleth, the username will also contain information from the headers.

Configuration

In order to use your class, you must extend the class loader and point your installation to that. This consists of four steps.
  1. Either implement the UsernameTransformer interface, or extend the TrivialUsernameTransformer
  2. Extend OA4MPConfigurationLoader and override createInstance, e.g.
            public class MyLoader<T extends ServiceEnvironmentImpl> extends OA4MPConfigurationLoader<T>{
                public MyLoader(ConfigurationNode node){
                     super.node();
                }
    
                 @Override
                 public T createInstance(){
                    T = super.createInstance();
                    MyTransformer mine; // Say your implementation is called MyTransformer
                    // create your transformer
                    t.setUsernameTransfomer(mine);
                    return T;
                 }
            }
        
  3. Extend the OA4MPBootstrapper to point to this, e.g.:
            public class MyBootstrapper extends OA4MPBootstrapper{
            @Override
              public ConfigurationLoader getConfigurationLoader(ConfigurationNode node) throws MyConfigurationException {
                  return new MyLoader(node);
              }
            }
        
  4. In your web.xml file, Point Tomcat at your bootstrapper:
            <listener>
               <listener-class>path.to.MyBootstrapper</listener-class>
            </listener>
        
It was decided to put this in the service environment rather than have some on-the-fly class loading system, since you then may have a considerably more complex class if needed (e.g. one that might have to farm out processes to the operating system at certain points).

Maven Dependencies

This section discusses what maven dependencies you need and what your project should ultimately look like. First and foremost, the dependencies that are required to roll a version of OA4MP are
    <dependency>
              <groupId>edu.uiuc.ncsa.myproxy</groupId>
              <artifactId>oa4mp-webapp</artifactId>
              <version>4.1.1</version>
              <type>war</type>
              <scope>runtime</scope>
          </dependency>
          <dependency>
              <groupId>edu.uiuc.ncsa.myproxy</groupId>
              <artifactId>oa4mp-server-api</artifactId>
              <version>4.1.1</version>
          </dependency>
  • oa4mp-webapp contains the JSP needed for the server.
  • oa4mp-server-api contains the actual java code.
Write your code and all you need is this in your maven pom.xml and a web.xml file in your src/main/java/webapps/WEB-INF directory.

Last modified 10/25/18.
©2000-2013 Board of Trustees of the University of Illinois.