CAS: User's Guide
Overview
Generating CAS credentials (cas-proxy-init)
Using CAS credentials (cas-wrap)
CAS Service Data
>Writing CAS clients
Performance Measurements
Writing CAS clients
Listed below are some helper methods in the client package that maybe used for writing clients for the CAS service. Refer to code and/or Java Docs for more information.
- Getting handle to CAS service port type
- To get a handle to CAS service with instance URL, instanceURL and identity serviceIdentity,
org.globus.ogsa.impl.base.cas.client.CasClientSetup is used.
Code:
CasClientSetup clientSetup = new CasClientSetup(); CommunityAuthorizationServicePortType casPort = clientSetup.getCASPort(instanceURL, serverIdentity);
CasClientSetup clientSetup = new CasClientSetup(); CommunityAuthorizationServicePortType casPort = clientSetup.getCASPort(instanceURL);
API in class org.globus.ogsa.impl.base.cas.client.CasProxyHelper can
be used to generate a proxy with CAS assertions embedded. To pass in relevant
parameters, class
org.globus.ogsa.impl.base.cas.client.ClientParams is used. The
datatype, org.globus.ogsa.impl.base.cas.client.ResourceActionsMap is
used to represent the resource/actions mapping for which assertions
are requested on.
Listed below are steps to use the
API. org.globus.ogsa.impl.base.cas.client.CasProxyInit has
sample code that generates a proxy embedded with CAS assertions.
Code:
-
ClientParams class is used to construct the parameter. If the default constructor is used and none of the values are set, requested assertion lifetime is set to 24 hours, default proxy file is used, the proxy with assertions embedded is named with a ".cas" tag at the end of proxy file.
ClientParams clientParams = new ClientParams();
- Sets assertion lifetime. If not set, 24 hours is used.
- Sets file name of the proxy to use. If not set, defualt credential is used.
- Sets file name of the proxy with CAS assertions to be written to. If not set, original proxy file name is appended with a tag.
- Sets tag to append to original proxy filename. If not set, the tag "cas" is used. The tag is used if a filename for assertion embedded proxy is not set.
- Sets the resource/actions for which assertion is requested on. It uses an array of data type ResourceActionsMap (explained below):
- ResouceActionsMap datatype is used to represent the resource and the actions on the resource for which the permissions are required. It has a String to represent resource and a vector of string sto represent the actions.
- Instance of Helper class:
- instanceURL is the URL to contact CAS service.
- serverIdentity is the expected identity of the server. If null, host authorization is used.
- Generating proxy with CAS assertions:
clientParams.setAssertionLifetime(lifetime);
clientParams.setProxyFileName(proxyFilename);
clientParams.setCasProxyFileName(casProxyFilename);
clientParams.setCasProxyTag(tag);
clientParams.setResourceActionsMap(resActions);
The resource should be of the form, "objectNamespace|objectName". The action should be of the form, "serviceType actionName"
CasProxyHelper casProxyHelper = new CasProxyHelper(instanceURL, serverIdentity);
where,
String casProxyFilename = casProxyHelper.getCasProxy(clientParams);
This methods contacts the CAS service, retrieves assertions, embeds in credetial and returns the path to the proxy file with CAS proxy embedded.