Skip to content

Commit 1c5239a

Browse files
committed
feat: Productize the addon saml-extension - EXO-69764
This addons allows to configure how exo read the assertions, in order to be able to work with persistent and transient name-id, and read username in another attribute
1 parent fe70fdb commit 1c5239a

File tree

7 files changed

+393
-9
lines changed

7 files changed

+393
-9
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ To configure it, there is 2 options :
100100
- unspecified : then you can choose a user attribute like username as name id
101101
- On exo side : the property `gatein.sso.saml.nameid.format` allow to configure the wanted nameid format. By dafault, value is `urn:oasis:names:tc:SAML:2.0:nameid-format:persistent`. It can be changed to `urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified` if needed
102102

103-
gatein.sso.saml.nameid.format
103+
#### Set username in other field than nameid
104+
In some installation, IDP requires that nameid is not the username but a numeric id. In this case, you can set the username in another field by setting theses properties in exo.properties
105+
```
106+
gatein.sso.saml.use.namedid=false
107+
gatein.sso.saml.subject.attribute=uid
108+
```
109+
110+
With this configuration, the username or email will be read in the attribute provided by the assertion.
111+
112+

packaging/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
<groupId>io.meeds.gatein.sso</groupId>
3939
<artifactId>sso-saml-plugin</artifactId>
4040
</dependency>
41+
<dependency>
42+
<groupId>org.exoplatform.addons.sso</groupId>
43+
<artifactId>saml2-addon-service</artifactId>
44+
</dependency>
4145
</dependencies>
4246

4347
<build>

packaging/src/main/assemblies/exo-saml-addon.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<outputDirectory>/lib</outputDirectory>
4444
<includes>
4545
<include>io.meeds.gatein.sso:sso-saml-plugin</include>
46+
<include>org.exoplatform.addons.sso:saml2-addon-service</include>
4647
<include>org.apache.santuario:xmlsec</include>
4748
</includes>
4849
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>

packaging/src/main/resources/exo-saml2-config/gatein/conf/saml2/picketlink-sp.xml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@
2121
<Handler
2222
class="org.gatein.sso.agent.saml.PortalSAML2LogOutHandler"/>
2323
<Handler
24-
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler">
25-
<Option Key="NAMEID_FORMAT" Value="${gatein.sso.saml.nameid.format::urn:oasis:names:tc:SAML:2.0:nameid-format:persistent}"/> </Handler>
24+
class="org.exoplatform.addons.saml.extensions.SAML2ExtendedAuthenticationHandler">
25+
<Option Key="NAMEID_FORMAT" Value="${gatein.sso.saml.nameid.format::urn:oasis:names:tc:SAML:2.0:nameid-format:persistent}"/>
26+
<Option Key="USE_NAMEID" Value="${gatein.sso.saml.use.namedid::true}"/>
27+
<Option Key="SUBJECT_ATTRIBUTE" Value="${gatein.sso.saml.subject.attribute::uid}"/>
28+
</Handler>
2629
<Handler
2730
class="org.picketlink.identity.federation.web.handlers.saml2.RolesGenerationHandler"/>
2831

29-
<!-- <Handler
30-
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler" /> -->
31-
<!-- <Handler
32-
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2SignatureGenerationHandler" /> -->
33-
<!-- <Handler
34-
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2SignatureValidationHandler"/> -->
32+
<!-- <Handler
33+
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler" /> -->
34+
<!-- <Handler
35+
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2SignatureGenerationHandler" /> -->
36+
<!-- <Handler
37+
class="org.picketlink.identity.federation.web.handlers.saml2.SAML2SignatureValidationHandler"/> -->
3538

3639
</Handlers>
3740

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
</scm>
4444

4545
<modules>
46+
<module>service</module>
4647
<module>packaging</module>
4748
</modules>
4849

@@ -65,6 +66,11 @@
6566
<type>pom</type>
6667
<scope>import</scope>
6768
</dependency>
69+
<dependency>
70+
<groupId>org.exoplatform.addons.sso</groupId>
71+
<artifactId>saml2-addon-service</artifactId>
72+
<version>${project.version}</version>
73+
</dependency>
6874
</dependencies>
6975
</dependencyManagement>
7076

service/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright (C) 2003-2023 eXo Platform SAS.
5+
6+
This program is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Affero General Public License
8+
as published by the Free Software Foundation; either version 3
9+
of the License, or (at your option) any later version.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, see<http://www.gnu.org/licenses />.
18+
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.exoplatform.addons.sso</groupId>
24+
<artifactId>saml2-addon-parent</artifactId>
25+
<version>7.1.x-SNAPSHOT</version>
26+
</parent>
27+
<artifactId>saml2-addon-service</artifactId>
28+
<name>eXo Add-on:: SAML2 add-on Service</name>
29+
<description>The SAML2 add-on Service</description>
30+
<dependencies>
31+
<dependency>
32+
<groupId>io.meeds.gatein.sso</groupId>
33+
<artifactId>sso-saml-plugin</artifactId>
34+
</dependency>
35+
</dependencies>
36+
<build>
37+
<finalName>${project.artifactId}</finalName>
38+
</build>
39+
</project>

0 commit comments

Comments
 (0)