splite
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1 @@
|
||||
/org/
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1 @@
|
||||
/org/
|
||||
-3
@@ -7,8 +7,6 @@ import org.springframework.util.Assert;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
@@ -28,7 +26,6 @@ import java.time.ZonedDateTime;
|
||||
* @author Scott Battaglia
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public abstract class AbstractTicket implements Ticket {
|
||||
|
||||
private static final long serialVersionUID = -8506442397878267555L;
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ import org.maxkey.domain.apps.CasDetails;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Lob;
|
||||
|
||||
/**
|
||||
* Domain object representing a Service Ticket. A service ticket grants specific
|
||||
@@ -25,7 +24,7 @@ public class ServiceTicketImpl extends AbstractTicket {
|
||||
/**
|
||||
* The service this ticket is valid for.
|
||||
*/
|
||||
@Lob
|
||||
|
||||
@Column(name = "SERVICE", nullable = false, length = Integer.MAX_VALUE)
|
||||
private Service service;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
@@ -0,0 +1 @@
|
||||
/org/
|
||||
+3
-2
@@ -2,8 +2,9 @@ package org.maxkey.authz.oauth2.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonCreator;
|
||||
import org.codehaus.jackson.annotate.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
/**
|
||||
* An OAuth 2 refresh token.
|
||||
|
||||
-2
@@ -21,8 +21,6 @@ import java.util.Set;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@org.codehaus.jackson.map.annotate.JsonSerialize(using = OAuth2AccessTokenJackson1Serializer.class)
|
||||
@org.codehaus.jackson.map.annotate.JsonDeserialize(using = OAuth2AccessTokenJackson1Deserializer.class)
|
||||
@com.fasterxml.jackson.databind.annotation.JsonSerialize(using = OAuth2AccessTokenJackson2Serializer.class)
|
||||
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = OAuth2AccessTokenJackson2Deserializer.class)
|
||||
|
||||
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.maxkey.authz.oauth2.common;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.codehaus.jackson.JsonParseException;
|
||||
import org.codehaus.jackson.JsonParser;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.JsonToken;
|
||||
import org.codehaus.jackson.map.DeserializationContext;
|
||||
import org.codehaus.jackson.map.JsonDeserializer;
|
||||
import org.codehaus.jackson.map.deser.StdDeserializer;
|
||||
import org.maxkey.authz.oauth2.common.util.OAuth2Utils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Provides the ability to deserialize JSON response into an {@link OAuth2AccessToken} with jackson by implementing
|
||||
* {@link JsonDeserializer}.
|
||||
* </p>
|
||||
* <p>
|
||||
* The expected format of the access token is defined by <a
|
||||
* href="http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-5.1">Successful Response</a>.
|
||||
* </p>
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @see OAuth2AccessTokenJackson1Serializer
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class OAuth2AccessTokenJackson1Deserializer extends StdDeserializer<OAuth2AccessToken> {
|
||||
|
||||
public OAuth2AccessTokenJackson1Deserializer() {
|
||||
super(OAuth2AccessToken.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OAuth2AccessToken deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
|
||||
JsonProcessingException {
|
||||
|
||||
String tokenValue = null;
|
||||
String tokenType = null;
|
||||
String refreshToken = null;
|
||||
Long expiresIn = null;
|
||||
Set<String> scope = null;
|
||||
Map<String, Object> additionalInformation = new LinkedHashMap<String, Object>();
|
||||
|
||||
// TODO What should occur if a parameter exists twice
|
||||
while (jp.nextToken() != JsonToken.END_OBJECT) {
|
||||
String name = jp.getCurrentName();
|
||||
jp.nextToken();
|
||||
if (OAuth2AccessToken.ACCESS_TOKEN.equals(name)) {
|
||||
tokenValue = jp.getText();
|
||||
}
|
||||
else if (OAuth2AccessToken.TOKEN_TYPE.equals(name)) {
|
||||
tokenType = jp.getText();
|
||||
}
|
||||
else if (OAuth2AccessToken.REFRESH_TOKEN.equals(name)) {
|
||||
refreshToken = jp.getText();
|
||||
}
|
||||
else if (OAuth2AccessToken.EXPIRES_IN.equals(name)) {
|
||||
try {
|
||||
expiresIn = jp.getLongValue();
|
||||
} catch (JsonParseException e) {
|
||||
expiresIn = Long.valueOf(jp.getText());
|
||||
}
|
||||
}
|
||||
else if (OAuth2AccessToken.SCOPE.equals(name)) {
|
||||
String text = jp.getText();
|
||||
scope = OAuth2Utils.parseParameterList(text);
|
||||
} else {
|
||||
additionalInformation.put(name, jp.readValueAs(Object.class));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO What should occur if a required parameter (tokenValue or tokenType) is missing?
|
||||
|
||||
DefaultOAuth2AccessToken accessToken = new DefaultOAuth2AccessToken(tokenValue);
|
||||
accessToken.setTokenType(tokenType);
|
||||
if (expiresIn != null) {
|
||||
accessToken.setExpiration(new Date(System.currentTimeMillis() + (expiresIn * 1000)));
|
||||
}
|
||||
if (refreshToken != null) {
|
||||
accessToken.setRefreshToken(new DefaultOAuth2RefreshToken(refreshToken));
|
||||
}
|
||||
accessToken.setScope(scope);
|
||||
accessToken.setAdditionalInformation(additionalInformation);
|
||||
|
||||
return accessToken;
|
||||
}
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.maxkey.authz.oauth2.common;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.codehaus.jackson.JsonGenerationException;
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.map.JsonSerializer;
|
||||
import org.codehaus.jackson.map.SerializerProvider;
|
||||
import org.codehaus.jackson.map.ser.SerializerBase;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Provides the ability to serialize an {@link OAuth2AccessToken} with jackson by implementing {@link JsonSerializer}.
|
||||
* Refer to {@link OAuth2AccessTokenJackson1Deserializer} to learn more about the JSON format that is used.
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @see OAuth2AccessTokenJackson1Deserializer
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class OAuth2AccessTokenJackson1Serializer extends SerializerBase<OAuth2AccessToken> {
|
||||
|
||||
public OAuth2AccessTokenJackson1Serializer() {
|
||||
super(OAuth2AccessToken.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(OAuth2AccessToken token, JsonGenerator jgen, SerializerProvider provider) throws IOException,
|
||||
JsonGenerationException {
|
||||
jgen.writeStartObject();
|
||||
jgen.writeStringField(OAuth2AccessToken.ACCESS_TOKEN, token.getValue());
|
||||
jgen.writeStringField(OAuth2AccessToken.TOKEN_TYPE, token.getTokenType());
|
||||
OAuth2RefreshToken refreshToken = token.getRefreshToken();
|
||||
if (refreshToken != null) {
|
||||
jgen.writeStringField(OAuth2AccessToken.REFRESH_TOKEN, refreshToken.getValue());
|
||||
}
|
||||
Date expiration = token.getExpiration();
|
||||
if (expiration != null) {
|
||||
long now = System.currentTimeMillis();
|
||||
jgen.writeNumberField(OAuth2AccessToken.EXPIRES_IN, (expiration.getTime() - now) / 1000);
|
||||
}
|
||||
Set<String> scope = token.getScope();
|
||||
if (scope != null && !scope.isEmpty()) {
|
||||
StringBuffer scopes = new StringBuffer();
|
||||
for (String s : scope) {
|
||||
Assert.hasLength(s, "Scopes cannot be null or empty. Got " + scope + "");
|
||||
scopes.append(s);
|
||||
scopes.append(" ");
|
||||
}
|
||||
jgen.writeStringField(OAuth2AccessToken.SCOPE, scopes.substring(0, scopes.length() - 1));
|
||||
}
|
||||
Map<String, Object> additionalInformation = token.getAdditionalInformation();
|
||||
for (String key : additionalInformation.keySet()) {
|
||||
jgen.writeObjectField(key, additionalInformation.get(key));
|
||||
}
|
||||
jgen.writeEndObject();
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -14,7 +14,8 @@ package org.maxkey.authz.oauth2.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
-2
@@ -12,8 +12,6 @@ import java.util.TreeMap;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@org.codehaus.jackson.map.annotate.JsonSerialize(using = OAuth2ExceptionJackson1Serializer.class)
|
||||
@org.codehaus.jackson.map.annotate.JsonDeserialize(using = OAuth2ExceptionJackson1Deserializer.class)
|
||||
@com.fasterxml.jackson.databind.annotation.JsonSerialize(using = OAuth2ExceptionJackson2Serializer.class)
|
||||
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = OAuth2ExceptionJackson2Deserializer.class)
|
||||
public class OAuth2Exception extends RuntimeException {
|
||||
|
||||
+6
-5
@@ -18,13 +18,14 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.codehaus.jackson.JsonParser;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.JsonToken;
|
||||
import org.codehaus.jackson.map.DeserializationContext;
|
||||
import org.codehaus.jackson.map.JsonDeserializer;
|
||||
import org.maxkey.authz.oauth2.common.util.OAuth2Utils;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
|
||||
+4
-4
@@ -15,10 +15,10 @@ package org.maxkey.authz.oauth2.common.exceptions;
|
||||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.map.JsonSerializer;
|
||||
import org.codehaus.jackson.map.SerializerProvider;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.maxkey.authz.oauth2.common.util;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class JacksonJsonParser implements JsonParser {
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, Object> parseMap(String json) {
|
||||
try {
|
||||
return mapper.readValue(json, Map.class);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalArgumentException("Cannot parse json", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatMap(Map<String, ?> map) {
|
||||
try {
|
||||
return mapper.writeValueAsString(map);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalArgumentException("Cannot format json", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+11
-9
@@ -12,17 +12,17 @@
|
||||
*/
|
||||
package org.maxkey.authz.oauth2.common.util;
|
||||
|
||||
import org.codehaus.jackson.JsonParseException;
|
||||
import org.codehaus.jackson.JsonParser;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.map.DeserializationContext;
|
||||
import org.codehaus.jackson.map.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
/**
|
||||
* JSON deserializer for Jackson to handle regular date instances as timestamps in ISO format.
|
||||
*
|
||||
@@ -32,16 +32,18 @@ import java.util.Date;
|
||||
public class JsonDateDeserializer extends JsonDeserializer<Date> {
|
||||
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Date deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
|
||||
public Date deserialize(com.fasterxml.jackson.core.JsonParser parser, DeserializationContext ctxt)
|
||||
throws IOException, JsonProcessingException {
|
||||
try {
|
||||
synchronized (dateFormat) {
|
||||
return dateFormat.parse(parser.getText());
|
||||
return dateFormat.parse(parser.toString());
|
||||
}
|
||||
}
|
||||
catch (ParseException e) {
|
||||
throw new JsonParseException("Could not parse date", parser.getCurrentLocation(), e);
|
||||
throw new JsonParseException( parser,"Could not parse date ",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -12,15 +12,16 @@
|
||||
*/
|
||||
package org.maxkey.authz.oauth2.common.util;
|
||||
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.map.JsonSerializer;
|
||||
import org.codehaus.jackson.map.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
/**
|
||||
* JSON serializer for Jackson to handle regular date instances as timestamps in ISO format.
|
||||
*
|
||||
|
||||
+1
-3
@@ -25,9 +25,7 @@ public class JsonParserFactory {
|
||||
if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
|
||||
return new Jackson2JsonParser();
|
||||
}
|
||||
if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", null)) {
|
||||
return new JacksonJsonParser();
|
||||
}
|
||||
|
||||
throw new IllegalStateException("No Jackson parser found. Please add Jackson to your classpath.");
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -23,13 +23,14 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.CharBuffer;
|
||||
|
||||
import org.codehaus.jackson.JsonFactory;
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.JsonParser;
|
||||
import org.codehaus.jackson.JsonToken;
|
||||
import org.maxkey.authz.oauth2.jwt.crypto.sign.SignatureVerifier;
|
||||
import org.maxkey.authz.oauth2.jwt.crypto.sign.Signer;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
/**
|
||||
* @author Luke Taylor
|
||||
*/
|
||||
|
||||
+4
-3
@@ -19,12 +19,13 @@ package org.maxkey.authz.oauth2.provider.approval;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.map.annotate.JsonDeserialize;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
import org.maxkey.authz.oauth2.common.util.JsonDateDeserializer;
|
||||
import org.maxkey.authz.oauth2.common.util.JsonDateSerializer;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Vidya Val
|
||||
|
||||
+3
-18
@@ -47,6 +47,8 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Basic, JDBC implementation of the client details service.
|
||||
*/
|
||||
@@ -302,29 +304,12 @@ public class JdbcClientDetailsService implements ClientDetailsService, ClientReg
|
||||
}
|
||||
|
||||
private static JsonMapper createJsonMapper() {
|
||||
if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", null)) {
|
||||
return new JacksonMapper();
|
||||
}
|
||||
else if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
|
||||
if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", null)) {
|
||||
return new Jackson2Mapper();
|
||||
}
|
||||
return new NotSupportedJsonMapper();
|
||||
}
|
||||
|
||||
private static class JacksonMapper implements JsonMapper {
|
||||
private org.codehaus.jackson.map.ObjectMapper mapper = new org.codehaus.jackson.map.ObjectMapper();
|
||||
|
||||
@Override
|
||||
public String write(Object input) throws Exception {
|
||||
return mapper.writeValueAsString(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T read(String input, Class<T> type) throws Exception {
|
||||
return mapper.readValue(input, type);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Jackson2Mapper implements JsonMapper {
|
||||
private com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,16 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
|
||||
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
|
||||
org.eclipse.jdt.core.builder.invalidClasspath=abort
|
||||
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
|
||||
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
|
||||
org.eclipse.jdt.core.circularClasspath=warning
|
||||
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
|
||||
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
|
||||
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
|
||||
org.eclipse.jdt.core.incompleteClasspath=error
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
|
||||
Reference in New Issue
Block a user