Setting runtime identity

The second thing we can tweak in the security configuration file is the runtime identity of the service (in each method). This allows us to control the identity the service assumes during that invocation. Although the practical use of what we're about to see this might not be immediately apparent, it is specially relevant for credential delegation (which we will see soon).

First thing you should now is that, in a service invocation, there are three relevant subjects. Remember that a subject contains a distinguished name of the form CN=Borja Sotomayor, OU=GT3 Tutorial, O=Globus.

Modifying the runtime identity through the security configuration file modifies the value of the invocation subject. We'll be able to give the invocation subject any of three possible identities:

Setting this up is pretty straightforward. The <method> element can contain, besides an <auth-method> element, a <run-as> element. This element, in turn, can contain an empty <caller-identity/>, <system-identity/>, or <service-identity/>, which will determine the runtime identity of the method.

We are going to configure each of our three methods with a different runtime identity. The security configuration would look like this:

<securityConfig xmlns="http://www.globus.org"
  xmlns:math="http://www.globus.org/namespaces/2004/02/progtutorial/MathService">

<method name="math:add">
  <run-as>
    <caller-identity/>
  </run-as>
</method>

<method name="math:subtract">
  <run-as>
    <system-identity/>
  </run-as>
</method>

<method name="math:getValue">
  <run-as>
    <service-identity/>
  </run-as>
</method>

</securityConfig>
[Note]

This file is $TUTORIAL_DIR/org/globus/progtutorial/services/security/first/config/security-config-runas.xml