diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-19 11:49:28 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-19 11:49:28 +0000 |
commit | eca8de9ef142245d65c69b97d10167849f9d56dd (patch) | |
tree | a1b31a43ee9af024bddac20b065125655e38b1df /sca-java-2.x/trunk | |
parent | e32b64d161654e654012f343e795d069bcf40ff8 (diff) |
TUSCANY-3949 = Applying Vijai's patch to correct policy namespaces + some extra fixes to correct the associated test case.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1172578 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
4 files changed, 27 insertions, 28 deletions
diff --git a/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java b/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java index c970704929..072ab32357 100644 --- a/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java +++ b/sca-java-2.x/trunk/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java @@ -24,15 +24,15 @@ import java.util.List; import javax.xml.namespace.QName; +import org.apache.tuscany.sca.assembly.xml.Constants; + /** * Models the SCA Implementation Security Policy Assertion for Authorization. * * @version $Rev$ $Date$ */ public class AuthorizationPolicy { - private final static String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; - // private final static String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - public static final QName NAME = new QName(SCA11_NS, "authorization"); + public static final QName NAME = new QName(Constants.SCA11_TUSCANY_NS, "authorization"); public static enum AcessControl { permitAll, denyAll, allow diff --git a/sca-java-2.x/trunk/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/trunk/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor index f402c6f749..aec301deb1 100644 --- a/sca-java-2.x/trunk/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ b/sca-java-2.x/trunk/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -18,12 +18,10 @@ # Implementation class for the artifact processor extension
org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#basicAuthentication,model=org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy
org.apache.tuscany.sca.policy.security.http.ssl.HTTPSPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#https,model=org.apache.tuscany.sca.policy.security.http.ssl.HTTPSPolicy
-
-# TODO - following processors are old and somewhat questionable for 2.x, needs reviewing
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#authorization,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#allow,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#permitAll,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#denyAll,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#runAs,model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
+org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#authorization,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
+org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#allow,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
+org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#permitAll,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
+org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#denyAll,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
+org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#runAs,model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#securityIdentity,model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#jaasAuthentication,model=org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicy
diff --git a/sca-java-2.x/trunk/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java b/sca-java-2.x/trunk/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java index 653f6d621c..4eb0f3284c 100644 --- a/sca-java-2.x/trunk/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java +++ b/sca-java-2.x/trunk/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java @@ -31,6 +31,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamReader; +import org.apache.tuscany.sca.assembly.xml.Constants; import org.apache.tuscany.sca.contribution.processor.ProcessorContext; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy; @@ -44,7 +45,7 @@ import org.junit.Test; * @version $Rev$ $Date$ */ public class PolicyProcessorTestCase { - private final static String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; + private final static List<String> SEQ = Arrays.asList("permitAll", "allow [r1, r2]", @@ -62,10 +63,10 @@ public class PolicyProcessorTestCase { Map<QName, StAXArtifactProcessor> processors = new HashMap<QName, StAXArtifactProcessor>(); processors.put(AuthorizationPolicy.NAME, new AuthorizationPolicyProcessor(null)); processors.put(SecurityIdentityPolicy.NAME, new SecurityIdentityPolicyProcessor(null)); - processors.put(new QName(SCA11_NS, "allow"), new AuthorizationPolicyProcessor(null)); - processors.put(new QName(SCA11_NS, "permitAll"), new AuthorizationPolicyProcessor(null)); - processors.put(new QName(SCA11_NS, "denyAll"), new AuthorizationPolicyProcessor(null)); - processors.put(new QName(SCA11_NS, "runAs"), new SecurityIdentityPolicyProcessor(null)); + processors.put(new QName(Constants.SCA11_TUSCANY_NS, "allow"), new AuthorizationPolicyProcessor(null)); + processors.put(new QName(Constants.SCA11_TUSCANY_NS, "permitAll"), new AuthorizationPolicyProcessor(null)); + processors.put(new QName(Constants.SCA11_TUSCANY_NS, "denyAll"), new AuthorizationPolicyProcessor(null)); + processors.put(new QName(Constants.SCA11_TUSCANY_NS, "runAs"), new SecurityIdentityPolicyProcessor(null)); InputStream is = getClass().getResourceAsStream("mock_policy_definitions.xml"); XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader reader = factory.createXMLStreamReader(is); diff --git a/sca-java-2.x/trunk/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml b/sca-java-2.x/trunk/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml index 91ab004a7e..fbb57428bd 100644 --- a/sca-java-2.x/trunk/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml +++ b/sca-java-2.x/trunk/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml @@ -24,23 +24,23 @@ <!-- POLICY SETS --> <policySet name="ps1" provides="authorization" appliesTo="sca:implementation"> - <authorization> - <permitAll /> - </authorization> + <tuscany:authorization> + <tuscany:permitAll /> + </tuscany:authorization> </policySet> <!-- POLICY SETS --> <policySet name="ps2" provides="authorization" appliesTo="sca:implementation"> - <authorization> - <allow roles="r1 r2" /> - </authorization> + <tuscany:authorization> + <tuscany:allow roles="r1 r2" /> + </tuscany:authorization> </policySet> <!-- POLICY SETS --> <policySet name="ps3" provides="authorization" appliesTo="sca:implementation"> - <authorization> - <denyAll /> - </authorization> + <tuscany:authorization> + <tuscany:denyAll /> + </tuscany:authorization> </policySet> <!-- POLICY SETS --> @@ -59,22 +59,22 @@ <!-- POLICY SETS --> <policySet name="ps6" provides="authorization" appliesTo="sca:implementation"> - <permitAll /> + <tuscany:permitAll /> </policySet> <!-- POLICY SETS --> <policySet name="ps7" provides="authorization" appliesTo="sca:implementation"> - <allow roles="r1 r2" /> + <tuscany:allow roles="r1 r2" /> </policySet> <!-- POLICY SETS --> <policySet name="ps8" provides="authorization" appliesTo="sca:implementation"> - <denyAll /> + <tuscany:denyAll /> </policySet> <!-- POLICY SETS --> <policySet name="ps9" provides="securityIdentity" appliesTo="sca:implementation"> - <runAs role="admin" /> + <tuscany:runAs role="admin" /> </policySet> </definitions>
\ No newline at end of file |