Skip to content

Commit

Permalink
Removing version numbers from xsl file matching to reduce testsuite m…
Browse files Browse the repository at this point in the history
…aintenance.
  • Loading branch information
Gonthim committed Sep 4, 2014
1 parent 73f7656 commit b9b75f2
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 228 deletions.
23 changes: 7 additions & 16 deletions testsuite/integration/src/test/xslt/enableRbac.xsl
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:do="urn:jboss:domain:3.0"
xmlns="urn:jboss:domain:3.0"
>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="yes"/>

<xsl:variable name="jboss" select="'urn:jboss:domain:'"/>

<!-- User params. -->
<xsl:param name="rbac" select="'rbac'"/>
<xsl:param name="realm" select="'ManagementRealm'"/>
Expand All @@ -13,18 +13,9 @@
<xsl:param name="rbac-user-props" select="'rbac-users.properties'"/>
<xsl:param name="rbac-groups-props" select="'rbac-groups.properties'"/>

<!-- Change the standalone access-control provider to rbac -->
<xsl:template match="/do:server/do:management/do:access-control" priority="100">
<xsl:copy>
<xsl:attribute name="provider">
<xsl:value-of select="$rbac"/>
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>

<!-- Change the domain access-control provider to rbac -->
<xsl:template match="/do:domain/do:management/do:access-control" priority="100">
<!-- Changes both domain and standalone access-control provider to rbac -->
<xsl:template match="//*[local-name()='management' and starts-with(namespace-uri(), $jboss)]
/*[local-name()='access-control']" priority="100">
<xsl:copy>
<xsl:attribute name="provider">
<xsl:value-of select="$rbac"/>
Expand Down
113 changes: 55 additions & 58 deletions testsuite/integration/src/test/xslt/setupRbacLdapAuthG2U.xsl
Expand Up @@ -21,77 +21,73 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:do="urn:jboss:domain:3.0"
xmlns="urn:jboss:domain:3.0"
>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="yes"/>

<xsl:variable name="jboss" select="'urn:jboss:domain:'"/>
<xsl:variable name="datasources" select="'urn:jboss:domain:datasources:'"/>

<xsl:template match="/do:server/do:management">
<xsl:template match="//*[local-name()='management' and starts-with(namespace-uri(), $jboss)]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<outbound-connections>
<ldap name="ldap" url="ldap://localhost:10389"/>
</outbound-connections>
</xsl:copy>
</xsl:template>

<xsl:template match="/do:server/do:management/do:security-realms/do:security-realm[@name='ManagementRealm']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<authentication>
<local default-user="UserMappedToGroupSuperUser"/> <!-- local user must authorize against LDAP -->
<ldap connection="ldap" base-dn="ou=Users,dc=wildfly,dc=org" user-dn="dn">
<username-filter attribute="uid"/>
</ldap>
</authentication>
<authorization map-groups-to-roles="false">
<ldap connection="ldap">
<username-to-dn force="false"> <!-- needed for local user -->
<username-filter base-dn="ou=Users,dc=wildfly,dc=org" user-dn-attribute="dn" attribute="uid" />
</username-to-dn>
<group-search group-name="SIMPLE" group-dn-attribute="dn" group-name-attribute="cn">
<group-to-principal base-dn="ou=Groups,dc=wildfly,dc=org" search-by="DISTINGUISHED_NAME">
<membership-filter principal-attribute="member"/>
</group-to-principal>
</group-search>
</ldap>
</authorization>
</xsl:copy>
</xsl:template>
<xsl:element name="outbound-connections" namespace="{namespace-uri()}">
<xsl:element name="ldap" namespace="{namespace-uri()}">
<xsl:attribute name="name">ldap</xsl:attribute>
<xsl:attribute name="url">ldap://localhost:10389</xsl:attribute>
</xsl:element>
</xsl:element>

<xsl:template match="/do:domain/do:management">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<outbound-connections>
<ldap name="ldap" url="ldap://localhost:10389"/>
</outbound-connections>
</xsl:copy>
</xsl:template>

<xsl:template match="/do:domain/do:management/do:security-realms/do:security-realm[@name='ManagementRealm']">
<xsl:template match="//*[local-name()='management' and starts-with(namespace-uri(), $jboss)]
/*[local-name()='security-realms']
/*[local-name()='security-realm' and @name='ManagementRealm']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<authentication>
<local default-user="UserMappedToGroupSuperUser"/> <!-- local user must authorize against LDAP -->
<ldap connection="ldap" base-dn="ou=Users,dc=wildfly,dc=org" user-dn="dn">
<username-filter attribute="uid"/>
</ldap>
</authentication>
<authorization map-groups-to-roles="false">
<ldap connection="ldap">
<username-to-dn force="false"> <!-- needed for local user -->
<username-filter base-dn="ou=Users,dc=wildfly,dc=org" user-dn-attribute="dn" attribute="uid" />
</username-to-dn>
<group-search group-name="SIMPLE" group-dn-attribute="dn" group-name-attribute="cn">
<group-to-principal base-dn="ou=Groups,dc=wildfly,dc=org" search-by="DISTINGUISHED_NAME">
<membership-filter principal-attribute="member"/>
</group-to-principal>
</group-search>
</ldap>
</authorization>

<xsl:element name="authentication" namespace="{namespace-uri()}">
<xsl:element name="local" namespace="{namespace-uri()}">
<xsl:attribute name="default-user">UserMappedToGroupSuperUser</xsl:attribute>
</xsl:element>
<xsl:element name="ldap" namespace="{namespace-uri()}">
<xsl:attribute name="connection">ldap</xsl:attribute>
<xsl:attribute name="base-dn">ou=Users,dc=wildfly,dc=org</xsl:attribute>
<xsl:attribute name="user-dn">dn</xsl:attribute>
<xsl:element name="username-filter" namespace="{namespace-uri()}">
<xsl:attribute name="attribute">uid</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="authorization" namespace="{namespace-uri()}">
<xsl:attribute name="map-groups-to-roles">false</xsl:attribute>
<xsl:element name="ldap" namespace="{namespace-uri()}">
<xsl:attribute name="connection">ldap</xsl:attribute>
<xsl:element name="username-to-dn" namespace="{namespace-uri()}">
<xsl:attribute name="force">false</xsl:attribute>
<xsl:element name="username-filter" namespace="{namespace-uri()}">
<xsl:attribute name="base-dn">ou=Users,dc=wildfly,dc=org</xsl:attribute>
<xsl:attribute name="user-dn-attribute">dn</xsl:attribute>
<xsl:attribute name="attribute">uid</xsl:attribute>
</xsl:element>
</xsl:element>
<xsl:element name="group-search" namespace="{namespace-uri()}">
<xsl:attribute name="group-name">SIMPLE</xsl:attribute>
<xsl:attribute name="group-dn-attribute">dn</xsl:attribute>
<xsl:attribute name="group-name-attribute">cn</xsl:attribute>
<xsl:element name="group-to-principal" namespace="{namespace-uri()}">
<xsl:attribute name="base-dn">ou=Groups,dc=wildfly,dc=org</xsl:attribute>
<xsl:attribute name="search-by">DISTINGUISHED_NAME</xsl:attribute>
<xsl:element name="membership-filter" namespace="{namespace-uri()}">
<xsl:attribute name="principal-attribute">member</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>

</xsl:copy>
</xsl:template>

Expand All @@ -103,3 +99,4 @@
</xsl:template>

</xsl:stylesheet>

103 changes: 48 additions & 55 deletions testsuite/integration/src/test/xslt/setupRbacLdapAuthU2G.xsl
Expand Up @@ -21,77 +21,70 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:do="urn:jboss:domain:3.0"
xmlns="urn:jboss:domain:3.0"
>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output indent="yes"/>

<xsl:variable name="jboss" select="'urn:jboss:domain:'"/>
<xsl:variable name="datasources" select="'urn:jboss:domain:datasources:'"/>

<xsl:template match="/do:server/do:management">
<xsl:template match="//*[local-name()='management' and starts-with(namespace-uri(), $jboss)]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<outbound-connections>
<ldap name="ldap" url="ldap://localhost:10389"/>
</outbound-connections>
</xsl:copy>
</xsl:template>

<xsl:template match="/do:server/do:management/do:security-realms/do:security-realm[@name='ManagementRealm']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<authentication>
<local default-user="UserMappedToGroupSuperUser"/> <!-- local user must authorize against LDAP -->
<ldap connection="ldap" base-dn="ou=Users,dc=wildfly,dc=org" user-dn="dn">
<username-filter attribute="uid"/>
</ldap>
</authentication>
<authorization map-groups-to-roles="false">
<ldap connection="ldap">
<username-to-dn force="false"> <!-- needed for local user -->
<username-filter base-dn="ou=Users,dc=wildfly,dc=org" user-dn-attribute="dn" attribute="uid" />
</username-to-dn>
<group-search group-name="SIMPLE" group-dn-attribute="dn" group-name-attribute="cn">
<principal-to-group group-attribute="seeAlso"/> <!-- seeAlso just exists in the default schema -->
</group-search>
</ldap>
</authorization>
</xsl:copy>
</xsl:template>
<xsl:element name="outbound-connections" namespace="{namespace-uri()}">
<xsl:element name="ldap" namespace="{namespace-uri()}">
<xsl:attribute name="name">ldap</xsl:attribute>
<xsl:attribute name="url">ldap://localhost:10389</xsl:attribute>
</xsl:element>
</xsl:element>

<xsl:template match="/do:domain/do:management">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<outbound-connections>
<ldap name="ldap" url="ldap://localhost:10389"/>
</outbound-connections>
</xsl:copy>
</xsl:template>

<xsl:template match="/do:domain/do:management/do:security-realms/do:security-realm[@name='ManagementRealm']">
<xsl:template match="//*[local-name()='management' and starts-with(namespace-uri(), $jboss)]
/*[local-name()='security-realms']
/*[local-name()='security-realm' and @name='ManagementRealm']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<authentication>
<local default-user="UserMappedToGroupSuperUser"/> <!-- local user must authorize against LDAP -->
<ldap connection="ldap" base-dn="ou=Users,dc=wildfly,dc=org" user-dn="dn">
<username-filter attribute="uid"/>
</ldap>
</authentication>
<authorization map-groups-to-roles="false">
<ldap connection="ldap">
<username-to-dn force="false"> <!-- needed for local user -->
<username-filter base-dn="ou=Users,dc=wildfly,dc=org" user-dn-attribute="dn" attribute="uid" />
</username-to-dn>
<group-search group-name="SIMPLE" group-dn-attribute="dn" group-name-attribute="cn">
<principal-to-group group-attribute="seeAlso"/> <!-- seeAlso just exists in the default schema -->
</group-search>
</ldap>
</authorization>
<xsl:element name="authentication" namespace="{namespace-uri()}">
<xsl:element name="local" namespace="{namespace-uri()}">
<xsl:attribute name="default-user">UserMappedToGroupSuperUser</xsl:attribute>
</xsl:element>
<xsl:element name="ldap" namespace="{namespace-uri()}">
<xsl:attribute name="connection">ldap</xsl:attribute>
<xsl:attribute name="base-dn">ou=Users,dc=wildfly,dc=org</xsl:attribute>
<xsl:attribute name="user-dn">dn</xsl:attribute>
<xsl:element name="username-filter" namespace="{namespace-uri()}">
<xsl:attribute name="attribute">uid</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="authorization" namespace="{namespace-uri()}">
<xsl:attribute name="map-groups-to-roles">false</xsl:attribute>
<xsl:element name="ldap" namespace="{namespace-uri()}">
<xsl:attribute name="connection">ldap</xsl:attribute>
<xsl:element name="username-to-dn" namespace="{namespace-uri()}">
<xsl:attribute name="force">false</xsl:attribute>
<xsl:element name="username-filter" namespace="{namespace-uri()}">
<xsl:attribute name="base-dn">ou=Users,dc=wildfly,dc=org</xsl:attribute>
<xsl:attribute name="user-dn-attribute">dn</xsl:attribute>
<xsl:attribute name="attribute">uid</xsl:attribute>
</xsl:element>
</xsl:element>
<xsl:element name="group-search" namespace="{namespace-uri()}">
<xsl:attribute name="group-name">SIMPLE</xsl:attribute>
<xsl:attribute name="group-dn-attribute">dn</xsl:attribute>
<xsl:attribute name="group-name-attribute">cn</xsl:attribute>
<xsl:element name="principal-to-group" namespace="{namespace-uri()}">
<xsl:attribute name="group-attribute">seeAlso</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:copy>
</xsl:template>


<!-- Copy everything else. -->
<xsl:template match="node()|@*">
<xsl:copy>
Expand Down

0 comments on commit b9b75f2

Please sign in to comment.