Skip to content

Commit

Permalink
Ensure the SAML Galleon feature pack generates an appropriate license…
Browse files Browse the repository at this point in the history
…s file

Closes #22623

(cherry picked from commit c9f867e)
  • Loading branch information
fjuma authored and ahus1 committed Sep 7, 2023
1 parent ef9726a commit 4ff16ea
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<properties>
<feature-pack.resources.directory>${basedir}/../../saml-adapters/wildfly-adapter/wildfly-jakarta-modules/src/main/resources</feature-pack.resources.directory>
<version.org.wildfly.galleon-plugins>6.4.0.Final</version.org.wildfly.galleon-plugins>
<xmlFileSource>${basedir}/src/main/resources/licenses/keycloak/licenses.xml</xmlFileSource>
<outputDirectory>${basedir}/target/resources/packages/licenses/content/docs/licenses-keycloak</outputDirectory>
<version.org.wildfly.maven.plugins.licenses-plugin>2.3.1.Final</version.org.wildfly.maven.plugins.licenses-plugin>
<license.directory>${project.build.directory}/resources/packages/docs.licenses/content/docs/licenses</license.directory>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -252,8 +252,27 @@
</executions>
</plugin>
<plugin>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-distribution-licenses-maven-plugin</artifactId>
<groupId>org.wildfly.maven.plugins</groupId>
<artifactId>licenses-plugin</artifactId>
<version>${version.org.wildfly.maven.plugins.licenses-plugin}</version>
<inherited>false</inherited>
<executions>
<execution>
<id>update-licenses-xml</id>
<goals>
<goal>insert-versions</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<generateVersionProperty>true</generateVersionProperty>
<sortByGroupIdAndArtifactId>true</sortByGroupIdAndArtifactId>
<licensesConfigFiles>
<licensesConfigFile>${basedir}/target/resources/license/licenses.xml</licensesConfigFile>
</licensesConfigFiles>
<licensesOutputFile>${license.directory}/keycloak-saml-adapter-galleon-pack-licenses.xml</licensesOutputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
<layer name="undertow"/>
</dependencies>
<feature spec="subsystem.keycloak-saml"/>
<packages>
<package name="docs.licenses" optional="true"/>
</packages>
</layer-spec>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" encoding="utf-8" standalone="no" media-type="text/html" />
<xsl:param name="version"/>
<xsl:param name="product.release.name"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz '" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ!'" />

<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="licenses.css"/>
</head>
<body>
<h2><xsl:value-of select="$product.release.name"/><xsl:text> </xsl:text><xsl:value-of select="substring-before($version, '-')"/></h2>
<p>The following material has been provided for informational purposes only, and should not be relied upon or construed as a legal opinion or legal advice.</p>
<!-- Read matching templates -->
<table>
<tr>
<th>Package Group</th>
<th>Package Artifact</th>
<th>Package Version</th>
<th>Remote Licenses</th>
<th>Local Licenses</th>
</tr>
<xsl:for-each select="licenseSummary/dependencies/dependency">
<xsl:sort select="concat(groupId, '.', artifactId)"/>
<xsl:variable name="GAV" select="concat(groupId, ':', artifactId, ':', version)"/>
<xsl:variable name="countOfPrevious" select="count(preceding-sibling::*[(concat(groupId, ':', artifactId, ':', version) = $GAV)])"/>
<xsl:if test="$countOfPrevious = 0">
<tr>
<td><xsl:value-of select="groupId"/></td>
<td><xsl:value-of select="artifactId"/></td>
<td><xsl:value-of select="version"/></td>
<td>
<xsl:for-each select="licenses/license">
<xsl:choose>
<xsl:when test="name = 'Public Domain'">
<xsl:value-of select="name"/><br/>
</xsl:when>
<xsl:otherwise>
<a href="{./url}"><xsl:value-of select="name"/></a><br/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</td>
<td>
<xsl:for-each select="licenses/license">
<xsl:variable name="filename">
<xsl:call-template name="remap-local-filename">
<xsl:with-param name="name" select="name" />
</xsl:call-template>
</xsl:variable>
<a href="{$filename}"><xsl:value-of select="$filename"/></a><br/>
</xsl:for-each>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

<xsl:template name="remap-local-filename">
<xsl:param name="name"/>
<xsl:choose>
<xsl:when test="$name = 'BSD 2-clause &quot;Simplified&quot; License'">
<xsl:text>bsd 2-clause simplified license.html</xsl:text>
</xsl:when>
<xsl:when test="$name = 'BSD 3-Clause &quot;New&quot; or &quot;Revised&quot; License'">
<xsl:text>bsd 3-clause new or revised license.html</xsl:text>
</xsl:when>
<xsl:when test="$name = 'Creative Commons Attribution 2.5'">
<xsl:text>creative commons attribution 2.5.html</xsl:text>
</xsl:when>
<xsl:when test="$name = 'FSF All Permissive License'">
<xsl:text>fsf all permissive license.html</xsl:text>
</xsl:when>
<xsl:when test="$name = 'Indiana University Extreme! Lab Software License 1.1.1'">
<xsl:text>indiana university extreme lab software license 1.1.1.html</xsl:text>
</xsl:when>
<xsl:when test="$name = 'MIT-0'">
<xsl:text>mit-0.html</xsl:text>
</xsl:when>
<xsl:when test="$name = 'Mozilla Public License 2.0'">
<xsl:text>mozilla public license 2.0.html</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(translate($name, $uppercase, $lowercase), '.txt')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) ${license.git.copyrightYears} The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" ?>

<package-spec xmlns="urn:jboss:galleon:package:2.0" name="docs.licenses">
</package-spec>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" ?>

<tasks xmlns="urn:wildfly:wildfly-feature-pack-tasks:3.1">
<copy-path src="docs/licenses/licenses.xsl" relative-to="content" target="docs/licenses/keycloak-saml-adapter-galleon-pack-licenses.xsl"/>
<transform stylesheet="docs/licenses/keycloak-saml-adapter-galleon-pack-licenses.xsl" src="docs/licenses/keycloak-saml-adapter-galleon-pack-licenses.xml" output="docs/licenses/keycloak-saml-adapter-galleon-pack-licenses.html" feature-pack-properties="true" phase="FINALIZING"/>
<delete path="docs/licenses/keycloak-saml-adapter-galleon-pack-licenses.xsl"/>
<line-endings phase="FINALIZING">
<unix>
<filter pattern="docs?licenses?keycloak-saml-adapter-galleon-pack-licenses.html" include="true"/>
</unix>
</line-endings>
</tasks>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
</dependencies>
<default-packages>
<package name="modules.all"/>
<package name="licenses"/>
</default-packages>
<generate-feature-specs>
<extensions>
Expand Down

0 comments on commit 4ff16ea

Please sign in to comment.