Access Keys:
Skip to content (Access Key - 0)

Documentation

compared with
Version 9 by Sarah Honacki
on Mar 02, 2009 13:24.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (154)

View Page History
{code}
public class ConcatServiceAuthorization{
...
...
public static void authorizeConcat() throws RemoteException {
...
...
String object = "http://authz.tutorials.cagrid.org/ConcatService";
String gridIdentity = getCallerIdentity();
String privilege = "ACCESS";
GridAuthorizationManager mgr =
new CSMGridAuthorizationManager("demo1");
authorized = mgr.isAuthorized(gridIdentity,object,privilege);
...
if(\!authorized){ throw new RemoteException("Not authorized to perform request"); }
}
...
if(!authorized){
throw new RemoteException("Not authorized to perform request");
}
}

public static void authorizeConcat2() throws RemoteException {
...
...
String object =
"{http://authz.tutorials.cagrid.org/ConcatService}concat2";
"{http://authz.tutorials.cagrid.org/ConcatService}concat2";
String gridIdentity = getCallerIdentity();
String privilege = "EXECUTE";
GridAuthorizationManager mgr =
new CSMGridAuthorizationManager("demo1");
authorized = mgr.isAuthorized(gridIdentity,object,privilege);
...
if(!authorized){ throw new RemoteException("Not authorized to perform request"); }
...
if(!authorized){
throw new RemoteException("Not authorized to perform request");
}
}
...
}
}
...
}
{code}

In CSM, privileges are grouped into a _role_ and protection elements are grouped into a *protection group*. To grant the members of a group a set of privileges on a set of protection elements, one must assign a projection-group-and-role pair to the group.

In the above diagram, we are saying that group \_{[https://localhost:8543/wsrf/services/cagrid/GridGrouper}st1:grp1|https://localhost:8543/wsrf/services/cagrid/GridGrouper%7Dst1:grp1] _has_ *_\_ACCESS and{_}* *{_}EXECUTE{_}* privileges on the [http://authz.tutorials.cagrid.org/ConcatService|http://authz.tutorials.cagrid.org/ConcatService] and [http://authz.tutorials.cagrid.org/ConcatService}concat2|http://authz.tutorials.cagrid.org/ConcatService%7Dconcat2] protection elements.
In the above diagram, we are saying that group \[https://localhost:8543/wsrf/services/cagrid/GridGrouper}\ st1:grp1|https://localhost:8543/wsrf/services/cagrid/GridGrouper%7Dst1:grp1] *has* *ACCESS* and *EXECUTE* privileges on the [http://authz.tutorials.cagrid.or/ConcatService|http://authz.tutorials.cagrid.org/ConcatService] and [http://authz.tutorials.cagrid.org/ConcatService}concat2|http://authz.tutorials.cagrid.org/ConcatService%7Dconcat2] protection elements.

Now we will look at how to create this policy using the CSM User Provisioning Tool (UPT).
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns="http://beans.authz.tutorials.cagrid.org/ConcatService"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://beans.authz.tutorials.cagrid.org/ConcatService"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
xmlns="http://beans.authz.tutorials.cagrid.org/ConcatService"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://beans.authz.tutorials.cagrid.org/ConcatService"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:element name="statement" type="StatementType"/>
<xs:complexType name="StatementType">
<xs:sequence>
<xs:element name="value" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required"/>
</xs:complexType>
<xs:sequence>
<xs:element name="value" type="xs:string"/>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required"/>
</xs:complexType>
<xs:element name="compoundStatement" type="CompoundStatement"/>
<xs:complexType name="CompoundStatement">
<xs:sequence>
<xs:element ref="statement" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

<xs:element name="compoundStatement" type="CompoundStatement"/>
<xs:complexType name="CompoundStatement">
<xs:sequence>
<xs:element ref="statement" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

</xs:schema>

{code}

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<\!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="csmPDP"
class="gov.nih.nci.cagrid.authorization.pdp.impl.CSMPDP">
<property name="authorizationManager">
<bean class="gov.nih.nci.security.SecurityServiceProvider"
class="gov.nih.nci.cagrid.authorization.pdp.impl.CSMPDP"> factory-method="getAuthorizationManager">
<property name="authorizationManager">
<bean class="gov.nih.nci.security.SecurityServiceProvider"
<constructor-arg value="demo1" />
factory-method="getAuthorizationManager"> </bean>
<constructor-arg value="demo1" />
</property>
<property name="selectorSelector" ref="selectorSelector" />
</bean>
<bean id="selectorSelector" class="gov.nih.nci.cagrid.authorization.pdp.impl.OperationPENodeSelectorSelector">
<property name="mappings">
</bean> <list>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*concat2" />
<property name="selector" ref="concat2" />
</bean>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*" />
<property name="selector" ref="theService" />
</bean>
</property> </list>
<property name="selectorSelector" ref="selectorSelector" />
</property>
</bean>
<bean id="concat2 class="gov.nih.nci.cagrid.authorization.pdp.impl.ConstantPENodeSelector">
<property name="privilege" value="EXECUTE"></property>
<property name="objectId"
value="{http://authz.tutorials.cagrid.org/ConcatService}concat2" />
</bean>
<bean id="theService" class="gov.nih.nci.cagrid.authorization.pdp.impl.ConstantPENodeSelector">
<property name="privilege" value="ACCESS"></property>
<property name="objectId"
value="http://authz.tutorials.cagrid.org/ConcatService" />
</bean>
</beans>
<bean id="selectorSelector" class="gov.nih.nci.cagrid.authorization.pdp.impl.OperationPENodeSelectorSelector">
<property name="mappings">
<list>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*concat2" />
<property name="selector" ref="concat2" />
</bean>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*" />
<property name="selector" ref="theService" />
</bean>
</list>
</property>
</bean>
<bean id="concat2 class="gov.nih.nci.cagrid.authorization.pdp.impl.ConstantPENodeSelector">
<property name="privilege" value="EXECUTE"></property>
<property name="objectId"
value="{http://authz.tutorials.cagrid.org/ConcatService}concat2" />
</bean>
<bean id="theService" class="gov.nih.nci.cagrid.authorization.pdp.impl.ConstantPENodeSelector">
<property name="privilege" value="ACCESS"></property>
<property name="objectId"
value="http://authz.tutorials.cagrid.org/ConcatService" />
</bean>
</beans>
{code}

{code:xml}
...
<bean id="selectorSelector"
class="gov.nih.nci.cagrid.authorization.pdp.impl.OperationPENodeSelectorSelector">
<property name="mappings">
<list>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*concat2" />
<property name="selector" ref="concat2" />
</bean>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*" />
<property name="selector" ref="theService" />
</bean>
</bean> </list>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.RegExPENodeSelectorMapping">
<property name="pattern" value=".*" />
<property name="selector" ref="theService" />
</bean>
</list>
</property>
</bean>
</property>
</bean>
...

{code}

...
<bean id="concat2 class="gov.nih.nci.cagrid.authorization.pdp.impl.ConstantPENodeSelector">
<property name="privilege" value="EXECUTE"/>
<property name="objectId"
value="{http://authz.tutorials.cagrid.org/ConcatService}concat2" />
</bean>
</bean>
<bean id="theService" class="gov.nih.nci.cagrid.authorization.pdp.impl.ConstantPENodeSelector">
<property name="privilege" value="ACCESS"/>
<property name="objectId"
value="http://authz.tutorials.cagrid.org/ConcatService" />
</bean>
</bean>
...

{code}

...
<application>
<context-name>demo1</context-name>
<authentication>
<lockout-time>10000</lockout-time>
<allowed-login-time>30000</allowed-login-time>
<allowed-attempts>10</allowed-attempts>
<authentication-provider-class/>
</authentication>
<authorization>
<authorization-provider-class>
gov.nih.nci.cagrid.authorization.impl.CSMGridAuthorizationManager
</authorization-provider-class>
<hibernate-config-file>
/Users/joshua/tutorials/authz/jakarta-tomcat-5.0.28/conf/demo1/hibernate.cfg.xml
</hibernate-config-file>
</authorization>
</application>
</application>
...

{code}

<?xml version="1.0" encoding="UTF-8"?>
<compoundStatement xmlns="http://beans.authz.tutorials.cagrid.org/ConcatService"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://beans.authz.tutorials.cagrid.org/ConcatService [file:/Users/joshua/dev/wtp3/ConcatService/statement.xsd]"> file:/Users/joshua/dev/wtp3/ConcatService/statement.xsd">
<statement id="1" >
<value>Howdy</value>
</statement>
<value>Howdy</value>
</statement>
<statement id="2">
<value>Pardner\!</value>
</statement>
<value>Pardner!</value>
</statement>
</compoundStatement>

{code}

{code:xml}
<beans>
...
<bean id="selectorSelector" ...>
<property name="mappings">
... <list>
<bean id="selectorSelector" ...>
<property name="mappings">
<list>
<bean ...>
<property name="pattern" value=".*concat2" />
<property name="selector" ref="concat2" />
</bean>
</bean>

<bean ...>
<property name="pattern" value=".*concat4" />
<property name="selector" ref="concat4" />
</bean>
</bean>

<bean ...>
<property name="pattern" value=".*" />
<property name="selector" ref="theService" />
</bean>
</bean> </list>
</property>
</bean>
...
<bean id="concat4"
</list> class="gov.nih.nci.cagrid.authorization.pdp.impl.XPathPENodeSelector">
</property>
</bean>
...
<bean id="concat4"
class="gov.nih.nci.cagrid.authorization.pdp.impl.XPathPENodeSelector">
<property name="privilege" value="ACCESS" />
<property name="xpathMap">
<map>
<entry>
<key>
<value>//\*[local-name(.)='statement'|local-name(.)='statement']</value>
</key>
<map>
<entry>
<key>
<value>//*[local-name(.)='statement']</value>
</key>
<bean class="gov.nih.nci.cagrid.authorization.pdp.impl.id.XSLTObjectIdGenerator">
<property name="xsl">
<value>
<\!\[CDATA\[
<![CDATA[
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="yes" method="xml"/>
<xsl:template match="\*[@id]">
<xsl:template match="*[@id]">
org.cagrid.tutorials.authz.beans.Statement.<xsl:value-of select="@id"/>
</xsl:template>
</xsl:template>
</xsl:stylesheet>
\]\]>
]]>
</value>
</property>
</property> </bean>
</entry>
</map>
</bean> </property>
</entry>
</map>
</property>
</bean>
...
</bean>
...
</beans>

{code}

Last edited by
Knowledge Center (1533 days ago) , ...
Adaptavist Theme Builder Powered by Atlassian Confluence