Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cas-client-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.apereo.cas.client.session;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.util.JSONPObject;
import org.apereo.cas.client.Protocol;
import org.apereo.cas.client.configuration.ConfigurationKeys;
import org.apereo.cas.client.util.CommonUtils;
Expand All @@ -33,6 +31,8 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tools.jackson.databind.json.JsonMapper;
import tools.jackson.databind.util.JSONPObject;

import java.util.Arrays;
import java.util.Base64;
Expand All @@ -57,7 +57,7 @@ public final class SingleSignOutHandler {

private final LogoutStrategy logoutStrategy = isServlet30() ? new Servlet30LogoutStrategy() : new Servlet25LogoutStrategy();

private final ObjectMapper mapper = new ObjectMapper();
private final JsonMapper mapper = JsonMapper.builder().build();

/** Mapping of token IDs and session IDs to HTTP sessions */
private SessionMappingStorage sessionMappingStorage = new HashMapBackedSessionMappingStorage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
import org.apereo.cas.client.validation.Cas30ServiceTicketValidator;
import org.apereo.cas.client.validation.TicketValidationException;

import com.fasterxml.jackson.core.JsonProcessingException;
import tools.jackson.core.JacksonException;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;

Expand All @@ -48,11 +47,9 @@ protected Assertion parseResponseFromServer(final String response) throws Ticket
try {
final var json = new JsonValidationResponseParser().parse(response);
return json.getAssertion(getProxyGrantingTicketStorage(), getProxyRetriever());
} catch (final JsonProcessingException e) {
} catch (final JacksonException e) {
logger.warn("Unable parse the JSON response. Falling back to XML", e);
return super.parseResponseFromServer(response);
} catch (final IOException e) {
throw new TicketValidationException(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,26 @@

import org.apereo.cas.client.util.CommonUtils;
import org.apereo.cas.client.validation.TicketValidationException;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import tools.jackson.databind.json.JsonMapper;

/**
* This is {@link JsonValidationResponseParser}.
*
* @author Misagh Moayyed
*/
final class JsonValidationResponseParser {
private final ObjectMapper objectMapper;
private final JsonMapper jsonMapper;

public JsonValidationResponseParser() {
this.objectMapper = new ObjectMapper();
this.objectMapper.findAndRegisterModules();
this.jsonMapper = JsonMapper.builder().build();
}

public TicketValidationJsonResponse parse(final String response) throws TicketValidationException, IOException {
public TicketValidationJsonResponse parse(final String response) throws TicketValidationException {
if (CommonUtils.isBlank(response)) {
throw new TicketValidationException("Invalid JSON response; The response is empty");
}

final var json = this.objectMapper.readValue(response, TicketValidationJsonResponse.class);
final var json = this.jsonMapper.readValue(response, TicketValidationJsonResponse.class);

final var serviceResponse = json.serviceResponse();
if (serviceResponse.authenticationFailure() != null
Expand Down
10 changes: 7 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,15 @@
<scope>test</scope>
<version>${log4j.version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<groupId>tools.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<type>pom</type>
<scope>import</scope>
<version>${jackson.version}</version>
</dependency>

<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
Expand Down Expand Up @@ -250,7 +254,7 @@
<spring.version>7.0.3</spring.version>
<ehcache.version>3.11.1</ehcache.version>
<slf4j.version>2.0.17</slf4j.version>
<jackson.version>2.21.0</jackson.version>
<jackson.version>3.0.4</jackson.version>
<javax.servlet.version>6.1.0</javax.servlet.version>
<commons.codec.version>1.20.0</commons.codec.version>
<log4j.version>1.2.17</log4j.version>
Expand Down