GT4 CAS Developer's Guide

1. Introduction

This document is an overview of the CAS server and its functionality. It is intended to help CAS developers understand the features of the current implementation and throws light on permissions, assertion generation and querying capability in CAS. This document also contains information that is useful when writing clients for the CAS server.

The Toolkit-level links at GT 4.0 Release Manuals provide general information such as best practices and coding guidelines used.

2. Before you begin

2.1. Feature summary

Features new in GT 4.0

  • None

Other Supported Features

  • File-level access control for GridFTP
  • Issuance of SAML authorization decisions

Deprecated Features

  • None

2.2. Tested platforms

Tested Platforms for CAS

  • Windows XP
  • Linux (Red Hat 7.3)

Tested Containers for CAS

  • Java WS Core container
  • Tomcat 5.0.30

2.3. Backward compatibility summary

Protocol changes in CAS since GT 3.2

  • There is no backward compatibility with 3.2 because of the port from OGSI to WSRF.

API changes since GT 3.2

  • None

Exception changes since GT 3.2

  • None

Schema changes since GT 3.2

  • WSDL reflects the port to WSRF from OGSI.

2.4. Technology dependencies

The CAS service depends on the following GT components:

  • WS Authentication and Authorization
  • Java WS Core

The CAS GridFTP authorization module depends on the following GT components:

  • Pre-WS Authentication and Authorization

The CAS service depends on the following 3rd party software:

  • OpenSAML

The CAS GridFTP authorization module depends on the following 3rd party software:

  • libxml

2.5. Security considerations

  • The database username/password is stored in the service configuration file and the test properties file. Ensure correct permissions to protect the information.

3. Architecture and design overview

The server essentially has users, actions, objects and policies governing the user's access to the objects for the purpose of performing specific actions. To better serve the requirements of a VO, the server allows grouping of users, actions and objects. This also facilitates specifying policies about them. The CAS server can be thought of as the front-end to a database that maintains state about such community permissions. The effect of each CAS request is either to modify this state or query it.

The server has two additional characteristics:

  • Some query results are signed. Such signed results can be used for authorization at resources and other policy enforcement points that acknowledge such credentials.
  • The same database is used to maintain information to control authorization decision for the CAS server.

The following topics contain related information:

3.1. CAS Database Overview

The CAS database contains a number of tables to store information about users, resources (objects), actions and policies. This section describes each of those tables and their contents. The tables are categorized into tables used to identify and organize users in the database (trust_anchor, user and user_group), tables used to describe actions (service_type, service_type_action, service_type_action_groups), tables used to describe and organize resources or objects (object, object_namespace and object_group) and tables used to describe policies (policy_statement).

3.1.1. Tables relating to users

There are two categories of people in the CAS database, trust anchors and the users. The users may further be placed in user groups and the granularity of operations on the CAS database with respect to users is a user group.

Table 1. User tables

trust_anchor table The trust_anchor table describes authorities that can generate credentials. It consists of tuples of {trust_anchor_nickname, authentication_method, authentication_data}. In general, the meaning of one of these tuples is that "database entries that refer to trust_anchor_nickname apply to the authority represented by authentication_data for authentication method authentication_method". The current implementation supports the following values in these fields: an authentication_method value of "x509" and an authentication_data value that is the certification authority's certificate. A trust_anchor_nickname value uniquely identifies an authentication_method and authentication_data across the database. For example, {globus_ca, x509, <contents of the globus CA cert>} associates the name globus_ca with the Globus CA certificate.
user tableThe user table consists of {user_nickname, trust_anchor_nickname, subject_name} tuples, which map raw authentication information into the symbolic names that appear in CAS user specifications. The intent of this tuple is to associate an internal name with a user that authenticates to the CAS service. The current implementation supports a subject_name which is the X509 distinguished name of a user. A subjectDN and trust anchor nickname uniquely identify an entry in the user_table. There is a one to one mapping between a user nickname and the combination of subjectDN and trust anchor nickname. For example, the tuple {user1, globus_ca, "/O=Globus/CN=User1 Name") indicates that the person who can authenticate as "/O=Globus/CN=User1 Name" using the authentication method of the trust anchor globus_ca has the permissions assigned to the user "user1" within the CAS database.
user_group tableThis table maintains a list of all user groups in the CAS database.
user_group_entry tableThe user_group_entry table consists of {group, user} tuples indicating that the specified user is a member of the group.

3.1.2. Tables to relating to actions

The database includes tables related to action specifications. Different services may define actions that have similar (or identical) names with different meanings and hence an action specification must include a service type in addition to the name of the action. The resource servers that receive CAS policy statements interpret the service types and actions. For example, a GridFTP server may honor policy statements that refer to the "file" service type and ignore policy statements for all other service types. In theory (because all this processing is done by the resource servers and not the CAS server), there's no need for the CAS server to keep track of allowable service types and actions. However, it is done to make it easier for administrators to detect and avoid errors while setting permissions.

The server also supports grouping of these service action mappings. Permissions may be granted to the service action groups or to a single service action.

Table 2. Action tables

service_type tableThis table lists all the service types in the database.
service_type_action tableThe service_type_action table consists of {service_type, action} tuples indicating that the specified action is valid for the specified service type. For example, a {service_type, action} of {file, read} means that read is a valid action for the service type file. This mapping is represented as "serviceType/action" in the current implementation.
service_action_groupThis table lists all the service action group names.
service_action_group_entryThis table contains the following tuple (group, serviceType/action). The tuple indicates that the serviceType/action belongs to group.

3.1.3. Tables related to resources/objects

An object specification refers to an object or group of objects. An "object" may itself refer to either a single physical object (e.g. a file) or a collection of objects (e.g. all files within a directory). A given object is relevant within a defined namespace and the properties of the namespace apply to the object.

Table 3. Resource Tables

namespace_tableThis table stores the following tuple (nickname, basename, comparisonAlg) indicating that objects in the namespace referred to by nickname in the CAS database are compared using the comparisonAlg and have a base URL of basename. A namespace uniquely identifies a single physical resource. For example, a namespace (ftpNS1, ftp://sample1.org/, wildcard) indicates that all object names within the realm of this namespace are to be compared using wildcard matching. Each comparison algorithm corresponds to a class in the CAS server code that implements an interface which defines routines for matching objects. The current implementation supports exact match and wildcard matching. Objects are represented as "objectNamespace|objectName" in the current implementation.
object tableStores the object name and the namespace that this object is in. For example, (/mydir/*, ftpNS1) implies that this object is within the ftpNs1 namespace, described above. Since this namespace has wild card matching /mydir/foo would match this object. CAS Objects can be either implicit (that is, those that are inherent to CAS) or explicit (that is, objects on other resources about which policies may be stored in the CAS database). While implicit objects may be of many types, external objects are always represented as type "object".
implicit objects

It is sometimes convenient to treat some of the entities defined within the CAS server (such as users and groups) as objects. These implicit objects can be added to object groups and can appear in policy statements. Such policy statements govern access permissions to the CAS database. The types of implicit objects are:

  • A user (a reference to an entry in the user table). This is used when granting permissions such as "may unenroll this user".
  • A user_group (a reference to an entry in the user_group table). This is used to grant permissions such as "may add users to this group".
  • A service_type (a reference to an entry in the service_type table). This is used when granting permissions such as "may add actions to this service type";
  • An object_group (a reference to an entry in the object_group table). This is used when granting permissions such as "may add objects to this object group".
  • A namespace (reference to an entry in namespace table). This is used when granting permission like "may unenroll this namespace".
  • A trust anchor (reference to an entry in the trust_anchor_table). This is used when granting permissions like "may grant rights on this trust anchor".
  • The CAS server itself. This is used when granting permissions such as "may add new users to the CAS server". This is added at start up to the object_table.

object_group tableThis table lists the names of object groups in the database.
object_group_entry tableThe object_group_entry table consists of {object_group, objectSpecification, objectSpecDesc} tuples; this tuple indicates that the specified objectSpecification of the type objectSepcDesc is a member of the specified object group. The objectSpecification is an identifier for a object of type objectSpecDesc, i.e. an object, object group, user, user group, service type, namespace or trust anchor.

3.1.4. Tables relating to policy statements

The CAS server keeps track of policy statements, which are composed of three parts: a user specification, which denotes a user or set of users; an action specification, which denotes an operation (e.g., read a file) or a group of operations; and an object specification, which specifies an object or group of objects.

For example, if we were to specify a policy statement as an English sentence, "User1 may read ftp://myhost.edu/myfile", then the user specification would be "User1", the action specification would be "file/read", and the object specification would be ftp://myhost.edu/myfile. In reality, the CAS server maintains this information as entries in database tables and translates it into a policy language when responding to a query.

The policy_statement table consists of (userGroup, actionSpec, actionSpecDesc, objectSpec, objectSpecDesc) tuples corresponding to the policy statements implied by this relationship:

Table 4. Policy Statement Table

userGroupA reference to an entry in the user_group table.
actionSpecA reference to an entry in the service_action table or service_action_group table.
actionSpecDescEither a "serviceAction" or "serviceActionGroup" describing the actionSpec entry.
objectSpecA reference to an entry in the object table, object_group_entry table, user table, user_group table, service_type table, namespace table or trust_anchor table.
objectSpecDescEither a "object", "objectGroup", "user", "userGroup", "serviceType", "namespace" or "trustAnchor" describing the objectSpec entry.

Each statement implies that users who belong to the userGroup are permitted to perform the service/action or all service/action(s) in the serviceActionGroup on the specified object or all objects in the said object group.

3.2. CAS Permissions

A user (U) is said to have permission to perform service/action S/A on object (O) if there is a statement in the policy_statement table that meets these three conditions:

  1. The user element applies: U appears in the user table and the user element is either:

    • a user_group_specification referring to a user_group containing U, or
    • the community_specification.

  2. The action element applies:

    • the action specification refers to service_type S and the action A.
    • the action specification refers to a service_action group that has service type S and action A as a member.
    • the action specification is superuser.

  3. The object element applies: it's either:

    • An object that "matches" O - that is, the appropriate matching function (based on the namespace that the object belongs to) applied to O and the object_name yields a match, or
    • An object group that contains an object that "matches" O.

3.3. CAS Requests

CAS requests can be broadly classified into administrative requests and query requests. Each CAS request requires some set of permissions. These permission are assessed by looking up the authenticated user in the user table (to get the CAS nickname mapped to this user) and using that to check if the policy table has a permission defined for the operation as described in the previous section.

3.4. CAS Administrative Requests

Administrative requests typically modify the database and are used to add or remove CAS table entries.

  • Enroll or unenroll trust anchors
  • Enroll or unenroll users
  • Create or delete namespaces
  • Create or delete objects
  • Create or delete service types
  • Add or remove service type/action mappings
  • Create or delete user, object or service action groups
  • Add or remove entries from any of the above
  • Define groups
  • Grant or revoke permissions

The above request asserts permissions and performs the operation preserving the database consistency. For example, a policy can be defined (or a right can be granted) only on objects that exist in the CAS database and so on.

Creation of any CAS object (like a trust anchor, namespace, object, user, service type, user group, object group, service_action group) allows the client to choose a user group (irrespective of whether the client belongs to the group or not) to which all permissions on the newly created object is granted. In the case of the operation where the user creates a new user group, if the client chooses to grant all permissions to the newly created user group, then the user is added to the new group.

3.5. CAS Query Requests

Query request are classified into

  • requests that return assertions that are typically signed and can be used by the client to authorize with some resource.
  • requests that return information about the current state of the CAS database.

3.6. Assertion requests

The CAS server supports requests to retrieve policy information as signed policy assertions. These assertions can be presented at a resource by the client for authorization purposes. A policy assertion includes a list of policy statements, the distinguished name of the user that the permissions apply to, a validity period (a start and end time corresponding to when the assertion is valid), and is signed by the CAS server. Each of the requests for policy assertions takes a lifetime argument (the desired lifetime of the policy assertion, in seconds) and the following is done to generate them.

  1. The applicable user is identified as described in Section 3.2, “CAS Permissions”.
  2. The applicable set of policy statements for the user are identified as described in Section 3.2, “CAS Permissions”.
  3. If the set is not empty, a policy assertion is created or else null is returned.
  4. The assertion lifetime is calculated as follows. If the requested lifetime is 0, the server's default lifetime is used, otherwise the minimum of the requested lifetime and the server's maximum lifetime is used.
  5. The list of {service/action, object} permissions, the validity time (start time is the current time, end time is the current time plus the assertion lifetime), and the applicable user's subject name is formed into a assertion.
  6. The assertion is signed and returned to the requester.

In the current implementation the Security Assertion Markup Language (SAML) standard defined by OASIS is used for the requests and responses involved in obtaining a authorization assertions. OpenSAML, an open source implementation of the SAML 1.0 specification, has been used as a utility to generate and process SAML queries and assertions.

The methods for the requests are:

Table 5. Request methods

getMaximalAssertion This is a self-request that any user in the CAS database may make. The set of policy statements returned is the complete set of the user's permissions, for all services other than the CAS service.
getUserAssertion In this case, an additional argument specifies the requested user; the set of policy statements is the complete set of that user's permissions for all services other than the CAS service. This request requires cas/query or cas/superuser permission on the cas/server object.
getAssertion This is a self-request that any user in the CAS database may make. In this case, the list of {service/action, object} permissions is determined as follows:

For each requested permission, if there is a policy statement granting the request in the CAS database, then the requested (service/action, object) is added to the returned assertion as a decision statement.

Assertion generation is done based primarily based on the objects. This has implications in the case of maximal assertion and user assertion generation, where all applicable polices are returned. The service restricts polices only based on objects and does not make a distinction on service type. For example, if a non-implicit object has a CAS service type policy on it, it will be returned as a part of the assertion. This might be useful in case some other CAS server is itself being treated as an external resource and the CAS service types are used.

4. Public interface

The semantics and syntax of the APIs and WSDL for the component, along with descriptions of domain-specific structured interface data, can be found in the Public Interface Guide.

5. Usage scenarios

Typically in a VO a single CAS service is run and several clients contact the service to retrieve assertions about operations on resources. These assertions can be then presented to the resources to gain access. Users with some administrative rights can grant/revoke access to these resources.

The toolkit ships with clients for users to retrieve and embed assertions in proxy and another to use that proxy to run some executable. Listed below are some helper methods in the client package that maybe used for writing other clients for the CAS service. Refer to code and/or Java Docs for more information.

  • To get a handle for the CAS service port type, the org.globus.cas.impl.client.CasClientSetup class can be used.

    Sample Code:

    To get a handle to a CAS service with instance URL instanceURL and identity serviceIdentity:

    CasClientSetup clientSetup = new CasClientSetup();
    CommunityAuthorizationServicePortType casPort = 
        clientSetup.getCASPort(instanceURL, serverIdentity);
  • To generate a proxy with embedded CAS assertions the API in the class org.globus.cas.impl.client.CasProxyHelper can be used. The class org.globus.cas.impl.client.ClientParams is used to pass in appropriate parameters and the datatype org.globus.cas.impl.client.ResourceActionsMap is used to represent the resource/actions mapping for which assertions are requested on.

    Listed below is sample code that uses the client side util API to generate a proxy with CAS assertions embedded in it.

    1. The ClientParams class is used to construct the parameter. If the default constructor is used and none of the values are set then the requested assertion lifetime is set to 24 hours, the default proxy file is used and the proxy containing the embedded assertions is named with a ".cas" extension at the end of the proxy file.

      ClientParams clientParams = new ClientParams();
    2. The following is used to set assertion lifetime. If not set then 24 hours is used.

      clientParams.setAssertionLifetime(lifetime);
    3. Set the file name of the proxy to use. If not set then the default credential is used.

      clientParams.setProxyFileName(proxyFilename);
    4. Set the file name that the proxy with CAS assertions will be written to. If not set then original proxy file name is appended with a tag.

      clientParams.setCasProxyFileName(casProxyFilename);
    5. Set the extension to append to the original proxy filename. If not set then the extension ".cas" is used. The extension is only used if a filename for the CAS proxy is not set.

      clientParams.setCasProxyTag(tag);
    6. Set the resource/actions for which the assertion is requested on. It uses an array of data type ResourceActionsMap (explained below).

      clientParams.setResourceActionsMap(resActions);
    7. The ResouceActionsMap datatype is used to represent the resource and the actions on the resource for which the permissions are required. It uses a String to represent the resource and a vector of strings to represent the actions.

      The resource should be of the form "objectNamespace|objectName". The action should be of the form "serviceType actionName".

    8. Create an instance of the Helper class:

      CasProxyHelper casProxyHelper = new CasProxyHelper(instanceURL, serverIdentity);

      Where:

      • instanceURL is the URL used to contact the CAS service.
      • serverIdentity is the expected identity of the server. If null, host authorization is used.
    9. Generate the proxy with CAS assertions:

      String casProxyFilename = casProxyHelper.getCasProxy(clientParams);

      This method contacts the CAS service, retrieves assertions, embeds the assertions in a proxy credential and returns the path to the proxy file.

6. Tutorials

There are no tutorials available at this time.

7. Debugging

Log output from the CAS server is a useful tool for debugging issues. Logging in CAS server code is based on the Jakarta Commons Logging API and is described in more detail here. As described in above section, configuration files need to be edited to enable logging at different levels. For example, to see all logging for the CAS server, the following lines need to be added:

# Server code
log4j.category.org.globus.cas.impl.service=DEBUG 

# Database access module
log4j.category.org.globus.cas.impl.databaseAccess=DEBUG 

Debugging information from CAS clients can be obtained by using the -debug option on the command line.

8. Troubleshooting

8.1. Command run using cas-wrap does not pick up CAS proxy

Some commands require environment variables to be passed explicitly to the command (e.g java). If running such command through cas-wrap, place the command in a script (passing in the environment variable) and execute the script through cas-wrap.

For example, to run java -DX509_USER_PROXY=$X509_USER_PROXY org.some.java.Client, create a script client-script with following contents:

java -DX509_USER_PROXY=$X509_USER_PROXY org.some.java.Client 

Ensure that the script has executable permissions and run:

 cas-wrap -t sometag client-script 

8.2.  CAS client fail with database permission error

CAS clients fail with database permission exception similar to:

Caused by: ERROR: permission denied for relation service_type_action

]; nested exception is:org.globus.cas.impl.databaseAccess.CasDBException:

[Note]Note

This is a specific instance of an error for the relation service_type_action. This error could be raised on any relation on the table.

Check that the user configured for accessing the database has the correct permissions on the database. The configuration is found in $GLOBUS_LOCATION/etc/globus_cas_server/jndi-config.xml. Typically the same username/password that is used to create the database should be used in the above configuration file since this will prevent permission issues.