Skip to content

Commit

Permalink
Merge branch 'master' into exclude-joda-time
Browse files Browse the repository at this point in the history
  • Loading branch information
gkhaburzaniya-onelogin committed Nov 18, 2022
2 parents 9531b5d + 10002ab commit 1661960
Show file tree
Hide file tree
Showing 48 changed files with 472 additions and 470 deletions.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# OneLogin's SAML Java Toolkit <!-- omit in toc -->
# SAML Java Toolkit <!-- omit in toc -->

[![Build Status](https://travis-ci.org/onelogin/java-saml.svg?branch=master)](https://travis-ci.org/onelogin/java-saml) [![Coverage Status](https://coveralls.io/repos/github/onelogin/java-saml/badge.svg?branch=master)](https://coveralls.io/github/onelogin/java-saml?branch=master)

## **Notice:** This project is currently not under active development, please see [#388](https://github.com/onelogin/java-saml/issues/388) for more information.

Add SAML support to your Java applications using this library.
Forget those complicated libraries and use that open source library provided and supported by OneLogin Inc.

2.8.0 uses xmlsec 2.2.3 which fixes [CVE-2021-40690](https://snyk.io/vuln/SNYK-JAVA-ORGAPACHESANTUARIO-1655558)

Expand Down Expand Up @@ -87,7 +84,7 @@ since 2002, but lately it has become popular due to its advantages as follows:

## General description

OneLogin's SAML Java toolkit lets you turn a Java application into a SP
SAML Java toolkit lets you turn a Java application into a SP
(Service Provider) that can be connected to an IdP (Identity Provider).

Supports:
Expand All @@ -108,7 +105,6 @@ Key features:
* **Easy to use** - Programmer will be allowed to code high-level and
low-level programming; 2 easy-to-use APIs are available.
* **Tested** - Thoroughly tested.
* **Popular** - OneLogin's customers use it. Add easy support to your java web projects.

## Security warning

Expand Down Expand Up @@ -198,7 +194,7 @@ Select a [Tomcat Server](http://crunchify.com/step-by-step-guide-to-setup-and-in
## Getting started
### Learning the toolkit

OneLogin's new SAML Java SAML Toolkit contains different folders (core, toolkit, samples) and some files.
Java SAML Toolkit contains different folders (core, toolkit, samples) and some files.

Let's start describing them:

Expand Down Expand Up @@ -261,7 +257,7 @@ onelogin.saml2.sp.entityid = http://localhost:8080/java-saml-tookit-jspsample/me
onelogin.saml2.sp.assertion_consumer_service.url = http://localhost:8080/java-saml-tookit-jspsample/acs.jsp

# SAML protocol binding to be used when returning the <Response>
# message. Onelogin Toolkit supports for this endpoint the
# message. SAMLToolkit supports for this endpoint the
# HTTP-POST binding only
onelogin.saml2.sp.assertion_consumer_service.binding = urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST

Expand All @@ -270,7 +266,7 @@ onelogin.saml2.sp.assertion_consumer_service.binding = urn:oasis:names:tc:SAML:2
onelogin.saml2.sp.single_logout_service.url = http://localhost:8080/java-saml-tookit-jspsample/sls.jsp

# SAML protocol binding to be used when returning the <LogoutResponse> or sending the <LogoutRequest>
# message. Onelogin Toolkit supports for this endpoint the
# message. SAMLToolkit supports for this endpoint the
# HTTP-Redirect binding only
onelogin.saml2.sp.single_logout_service.binding = urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect

Expand Down Expand Up @@ -326,7 +322,7 @@ onelogin.saml2.idp.entityid =
onelogin.saml2.idp.single_sign_on_service.url =

# SAML protocol binding to be used to deliver the <AuthnRequest> message
# to the IdP. Onelogin Toolkit supports for this endpoint the
# to the IdP. SAMLToolkit supports for this endpoint the
# HTTP-Redirect binding only
onelogin.saml2.idp.single_sign_on_service.binding = urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect

Expand All @@ -340,7 +336,7 @@ onelogin.saml2.idp.single_logout_service.url =
onelogin.saml2.idp.single_logout_service.response.url =

# SAML protocol binding to be used when returning the <Response>
# message. Onelogin Toolkit supports for this endpoint the
# message. SAMLToolkit supports for this endpoint the
# HTTP-Redirect binding only
onelogin.saml2.idp.single_logout_service.binding = urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect

Expand Down Expand Up @@ -755,7 +751,7 @@ In order to avoid replay attacks, you can store the ID of the SAML messages alre
Get the ID of the last processed message with the getLastMessageId method of the Auth object.

## Demo included in the toolkit
The Onelogin's Java Toolkit allows you to provide the settings in a unique file as described at the [Settings section](https://github.com/onelogin/java-saml/#Settings).
The Java Toolkit allows you to provide the settings in a unique file as described at the [Settings section](https://github.com/onelogin/java-saml/#Settings).

#### SP setup
Configure the SP part and review the metadata of the IdP and complete the IdP info. Later configure how the toolkit will work enabling/disabling the security settings.
Expand Down
8 changes: 7 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</parent>

<packaging>jar</packaging>
<name>OneLogin java-saml Toolkit Core</name>
<name>java-saml Toolkit Core</name>
<artifactId>java-saml-core</artifactId>

<dependencies>
Expand Down Expand Up @@ -68,6 +68,12 @@
<version>4.3.4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
Expand Down
30 changes: 15 additions & 15 deletions core/src/main/java/com/onelogin/saml2/authn/AuthnRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.onelogin.saml2.util.Util;

/**
* AuthNRequest class of OneLogin's Java Toolkit.
* AuthNRequest class of Java Toolkit.
*
* A class that implements SAML 2 Authentication Request
*/
Expand Down Expand Up @@ -79,7 +79,7 @@ public AuthnRequest(Saml2Settings settings) {
public AuthnRequest(Saml2Settings settings, boolean forceAuthn, boolean isPassive, boolean setNameIdPolicy, String nameIdValueReq) {
this(settings, new AuthnRequestParams(forceAuthn, isPassive, setNameIdPolicy, nameIdValueReq));
}

/**
* Constructs the AuthnRequest object.
*
Expand Down Expand Up @@ -126,7 +126,7 @@ public AuthnRequest(Saml2Settings settings, AuthnRequestParams params) {
* This method is invoked at construction time, after all the other fields of
* this class have already been initialised. Its default implementation simply
* returns the input XML as-is, with no change.
*
*
* @param authnRequestXml
* the XML produced for this AuthnRequest by the standard
* implementation provided by {@link AuthnRequest}
Expand All @@ -144,10 +144,10 @@ protected String postProcessXml(final String authnRequestXml, final AuthnRequest
/**
* @return the base64 encoded unsigned AuthnRequest (deflated or not)
*
* @param deflated
* @param deflated
* If deflated or not the encoded AuthnRequest
*
* @throws IOException
* @throws IOException
*/
public String getEncodedAuthnRequest(Boolean deflated) throws IOException {
String encodedAuthnRequest;
Expand All @@ -161,18 +161,18 @@ public String getEncodedAuthnRequest(Boolean deflated) throws IOException {
}
return encodedAuthnRequest;
}

/**
* @return base64 encoded, unsigned AuthnRequest (deflated or not)
*
* @throws IOException
*
* @throws IOException
*/
public String getEncodedAuthnRequest() throws IOException {
return getEncodedAuthnRequest(null);
}

/**
* @return unsigned plain-text AuthnRequest.
* @return unsigned plain-text AuthnRequest.
*/
public String getAuthnRequestXml() {
return authnRequestString;
Expand All @@ -185,9 +185,9 @@ public String getAuthnRequestXml() {
* the authentication request input parameters
* @param settings
* Saml2Settings object. Setting data
*
* @return the StrSubstitutor object of the AuthnRequest
*/
*
* @return the StrSubstitutor object of the AuthnRequest
*/
private StrSubstitutor generateSubstitutor(AuthnRequestParams params, Saml2Settings settings) {

Map<String, String> valueMap = new HashMap<String, String>();
Expand Down Expand Up @@ -242,7 +242,7 @@ private StrSubstitutor generateSubstitutor(AuthnRequestParams params, Saml2Setti
if (organization != null) {
String displayName = organization.getOrgDisplayName();
if (!displayName.isEmpty()) {
providerStr = " ProviderName=\""+ Util.toXml(displayName) + "\"";
providerStr = " ProviderName=\""+ Util.toXml(displayName) + "\"";
}
}
valueMap.put("providerStr", providerStr);
Expand Down Expand Up @@ -288,10 +288,10 @@ public String getId()
{
return id;
}

/**
* Returns the issue instant of this message.
*
*
* @return a new {@link Calendar} instance carrying the issue instant of this message
*/
public Calendar getIssueInstant() {
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/com/onelogin/saml2/authn/SamlResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import com.onelogin.saml2.util.Util;

/**
* SamlResponse class of OneLogin's Java Toolkit.
* SamlResponse class of Java Toolkit.
*
* A class that implements SAML 2 Authentication Response parser/validator
*/
Expand Down Expand Up @@ -752,7 +752,7 @@ public String getResponseIssuer() throws XPathExpressionException, ValidationErr
}
return null;
}

/**
* Gets the Assertion Issuer.
*
Expand All @@ -777,7 +777,7 @@ public String getAssertionIssuer() throws XPathExpressionException, ValidationEr
throw new ValidationError("Issuer of the Assertion not found or multiple.", ValidationError.ISSUER_NOT_FOUND_IN_ASSERTION);
}
}

/**
* Gets the Issuers (from Response and Assertion). If the same issuer appears
* both in the Response and in the Assertion (as it should), the returned list
Expand Down Expand Up @@ -1102,11 +1102,11 @@ public String getError() {
public Exception getValidationException() {
return validationException;
}

/**
* Sets the validation exception that this {@link SamlResponse} should return
* when a validation error occurs.
*
*
* @param validationException
* the validation exception to set
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.onelogin.saml2.exception;

/**
* Top-level exception class for the OneLogin SAML client.
* Top-level exception class for the SAML client.
*/
public class SAMLException extends Exception {

Expand All @@ -10,7 +10,7 @@ public class SAMLException extends Exception {
/**
* Construct a SAMLException with the provided error message.
*
* @param message
* @param message
* The human-readable error message associated with this exception.
*/
public SAMLException(String message) {
Expand All @@ -33,12 +33,12 @@ public SAMLException(Throwable cause) {
*
* @param message
* The human-readable error message associated with this exception.
*
* @param cause
*
* @param cause
* The upstream cause associated with this exception.
*/
public SAMLException(String message, Throwable cause) {
super(message, cause);
}

}
}
Loading

0 comments on commit 1661960

Please sign in to comment.