Skip to content

Commit 41e7fe1

Browse files
committed
Add a build file for the main code. Make the sample project depend on this jar so that we don't need to update two copies of the code when making changes. Update the README to describe this new setup and convert it to a markdown file for better formatting
1 parent d15ec00 commit 41e7fe1

14 files changed

Lines changed: 57 additions & 398 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target

README renamed to README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
This example was developed to show how Java Toolkit works.
22

3-
The com-folder contains the files you'll copy into your Java application.
4-
The sample-folder has a minimal webapp with the files on com-folder inside java-folder and The files index.jsp and consume.jsp inside webapp-folder.
5-
index.jsp and consume.jsp are the ones that actually handle the SAML conversation.
3+
Project Structure
4+
-----------------
65

7-
The index.jsp file acts as an initiater for the SAML conversation, if it should be initiated by the application.
6+
The com/ folder contains the files you'll copy into your Java application. Note also that Apache Commons Codec is a dependency.
7+
8+
The sample/ folder has a minimal webapp which depends on the core code inside com/ folder and the files index.jsp and consume.jsp inside webapp-folder.
9+
index.jsp and consume.jsp are the ones that actually handle the SAML conversation. Dependencies are configured in the pom.xml file.
10+
11+
SAML Overview for project
12+
-------------------------
13+
14+
The index.jsp file acts as an initiater for the SAML conversation, if it should be initiated by the application.
815

916
This is called Service Provider Initiated SAML. The service provider creates a SAML Authentication Request and sends it to the identity provider (IdP),
1017
We authenticate at the IdP and then a Response is sent to the Consumer Service Url configured on index.jsp.
1118

12-
In order to know where to redirect the user with the authentication request, we need to establish the user's identity provider affinity.
19+
In order to know where to redirect the user with the authentication request, we need to establish the user's identity provider affinity.
1320
This depends on your application. In this example, those validations are provided by consume.jsp, which is meant as a stub for you customization.
1421

15-
Dependencies are configured on file pom.xml, also a jetty plugin is configured to execute the example with command "mvn jetty:run"
22+
Running the sample
23+
------------------
24+
25+
First install the core code into your local Maven repository with:
26+
27+
mvn install
28+
29+
You can now run the web app sample which depends on this code:
30+
31+
cd sample
32+
mvn jetty:run
1633

1734

1835
What needs to be configured
@@ -33,5 +50,5 @@ accSettings.setIdpSsoTargetUrl
3350
The URL to which the authentication request should be sent. This would be on the identity provider.
3451

3552
accountSettings.setCertificate
36-
The x509 certificate fingerprint.
53+
The x509 certificate fingerprint.
3754
This is provided from the identity provider when setting up the relationship, for this version the certificate must be 1024-bit.

pom.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.onelogin</groupId>
5+
<artifactId>java-saml</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<name>java-saml</name>
8+
9+
<dependencies>
10+
<dependency>
11+
<groupId>commons-codec</groupId>
12+
<artifactId>commons-codec</artifactId>
13+
<version>1.9</version>
14+
</dependency>
15+
</dependencies>
16+
17+
<build>
18+
<finalName>java-saml</finalName>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.apache.maven.plugins</groupId>
22+
<artifactId>maven-compiler-plugin</artifactId>
23+
<version>3.0</version>
24+
<configuration>
25+
<source>1.7</source>
26+
<target>1.7</target>
27+
</configuration>
28+
</plugin>
29+
</plugins>
30+
</build>
31+
</project>

sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.onelogin</groupId>
5-
<artifactId>java-saml</artifactId>
5+
<artifactId>java-saml-sample</artifactId>
66
<packaging>war</packaging>
77
<version>1.0-SNAPSHOT</version>
88
<name>java-saml Sample Webapp</name>

sample/src/main/java/com/onelogin/AccountSettings.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

sample/src/main/java/com/onelogin/AppSettings.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

sample/src/main/java/com/onelogin/saml/AuthRequest.java

Lines changed: 0 additions & 97 deletions
This file was deleted.

sample/src/main/java/com/onelogin/saml/Certificate.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)