|
18 | 18 | */
|
19 | 19 | package org.mitre.openid.connect.service.impl;
|
20 | 20 |
|
21 |
| -import com.google.common.io.BaseEncoding; |
22 |
| -import com.google.gson.stream.JsonReader; |
23 |
| -import com.google.gson.stream.JsonToken; |
24 |
| -import com.google.gson.stream.JsonWriter; |
25 | 21 | import java.io.ByteArrayInputStream;
|
26 | 22 | import java.io.ByteArrayOutputStream;
|
27 | 23 | import java.io.IOException;
|
|
37 | 33 | import java.util.Map;
|
38 | 34 | import java.util.Map.Entry;
|
39 | 35 | import java.util.Set;
|
| 36 | + |
40 | 37 | import org.mitre.jose.JWEAlgorithmEmbed;
|
41 | 38 | import org.mitre.jose.JWEEncryptionMethodEmbed;
|
42 | 39 | import org.mitre.jose.JWSAlgorithmEmbed;
|
|
71 | 68 | import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
72 | 69 | import org.springframework.stereotype.Service;
|
73 | 70 |
|
| 71 | +import com.google.common.io.BaseEncoding; |
| 72 | +import com.google.gson.stream.JsonReader; |
| 73 | +import com.google.gson.stream.JsonToken; |
| 74 | +import com.google.gson.stream.JsonWriter; |
| 75 | + |
74 | 76 | /**
|
75 | 77 | *
|
76 | 78 | * Data service to import and export MITREid 1.0 configuration.
|
@@ -257,6 +259,9 @@ private void writeAuthorizationRequest(AuthorizationRequest authReq, JsonWriter
|
257 | 259 | }
|
258 | 260 |
|
259 | 261 | private String base64UrlEncodeObject(Serializable obj) throws IOException {
|
| 262 | + if (obj == null) { |
| 263 | + return null; |
| 264 | + } |
260 | 265 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
261 | 266 | ObjectOutputStream oos = new ObjectOutputStream(baos);
|
262 | 267 | oos.writeObject(obj);
|
@@ -670,8 +675,12 @@ private void readAuthenticationHolders(JsonReader reader) throws IOException {
|
670 | 675 | if (subName.equals("clientAuthorization")) {
|
671 | 676 | clientAuthorization = readAuthorizationRequest(reader);
|
672 | 677 | } else if (subName.equals("userAuthentication")) {
|
673 |
| - String authString = reader.nextString(); |
674 |
| - userAuthentication = base64UrlDecodeObject(authString, Authentication.class); |
| 678 | + if (reader.peek() == JsonToken.NULL) { |
| 679 | + reader.skipValue(); |
| 680 | + } else { |
| 681 | + String authString = reader.nextString(); |
| 682 | + userAuthentication = base64UrlDecodeObject(authString, Authentication.class); |
| 683 | + } |
675 | 684 | } else {
|
676 | 685 | logger.debug("Found unexpected entry");
|
677 | 686 | reader.skipValue();
|
|
0 commit comments