The Server Configuration File.

This contains a few examples of server configurations. You should read the main configuration document first.

Example. Specifying an OAuth 2.0 configuration.

E.g. Let us say you have the following configuration:

<config>
    <service name="my-config">
    <!-- lots of other stuff -->
    </service>
</config>

You would need to put the following into your web.xml file:

<context-param>
    <param-name>oa4mp:oauth2.server.config.file</param-name>
    <param-value>/path/to/cfg.xml</param-value>
</context-param>
<context-param>
    <param-name>oa4mp:oauth2.server.config.name</param-name>
    <param-value>my-config</param-value>
</context-param>

An alias example.

You may also have several configurations within a file and specify an alias or alternate name. This allows you to very easily switch configurations, keep old ones or have test configurations. To specify a configuration as an alias, you need to specify the name and alias tags:

<config>
    <service name="default" alias="new-config"/>
    <service name="new-config">
       <!-- whole bunch of stuff for the actual configuration -->
    </service>

    <service name="mysql-5.0.2">
       <!-- complete configuration here -->
    </service>
</config>

In the example above, the service would be configured to always use "default" but the configuration is aliased to map this to "new-config". A typical use might be that the service is trying to migrate from mysql 5.0.2 and wants to preserve the old configuration so as to back out as needed. Again, you may have any number of aliases and aliases are transitive, so an alias can refer to another alias and so forth and these will be resolved down the chain.

Including other configuration files.

There is now (as of OA4MP 1.1) the ability to include other configuration files. Note that

An example. Two configuration files.

Reworking the above example, this is completely equivalent to
<config>
    <service name="default" alias="new-config"/>
    <file include="/path/to/server-cfg.xml"/>
</config>
and the file /path/to/server-cfg.xml is below:
<config>
    <service name="new-config">
       <!-- whole bunch of stuff for the actual configuration -->
    </service>

    <service name="mysql-5.0.2">
       <!-- complete configuration here -->
    </service>
</config>
You only need refer to the first file in your deployment descriptor. The second (and any others) will be loaded for you.

A really great use of this is specifying an administrative configuration. This lets you point to your main configuration as well as have other specialized configurations (such a file store for backing up a database, monitoring clients, etc.) You need only have a single server configuration file and refer to that.

Another use of configuration files is if you are running multiple versions of OA4MP. For instance, have a file for OAuth 1.0a-based configuration and one for OAuth2 - based ones. Then have a file that refers to these with aliases for the currently active configurations.


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