From 251411e3d7f14b6970e38daaceee2c508152dfac Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Wed, 27 May 2015 19:31:04 -0400 Subject: [PATCH] added non-binary export for 1.2+ data compatibility. --- .../service/impl/MITREidDataService_1_0.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/MITREidDataService_1_0.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/MITREidDataService_1_0.java index 216f7df2c..58444ad43 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/MITREidDataService_1_0.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/MITREidDataService_1_0.java @@ -216,6 +216,26 @@ public class MITREidDataService_1_0 implements MITREidDataService { writeAuthorizationRequest(oa2Auth.getAuthorizationRequest(), writer); String userAuthentication = base64UrlEncodeObject(oa2Auth.getUserAuthentication()); writer.name("userAuthentication").value(userAuthentication); + + // this value is for 1.2+ compatibility (dropping binary objects from exports) + writer.name("savedUserAuthentication"); + if (oa2Auth.getUserAuthentication() != null) { + writer.beginObject(); + writer.name("name").value(oa2Auth.getUserAuthentication().getName()); + writer.name("sourceClass").value(oa2Auth.getUserAuthentication().getClass().getName()); + writer.name("authenticated").value(oa2Auth.getUserAuthentication().isAuthenticated()); + writer.name("authorities"); + writer.beginArray(); + for (GrantedAuthority authority : oa2Auth.getUserAuthentication().getAuthorities()) { + writer.value(authority.getAuthority()); + } + writer.endArray(); + + writer.endObject(); + } else { + writer.nullValue(); + } + writer.endObject(); writer.endObject(); logger.debug("Wrote authentication holder {}", holder.getId());