Got read/ingest mostly working. clientId and authenticationHolderId still not being set properly on tokens.
parent
6da73b0f39
commit
99c8e1c285
|
@ -534,6 +534,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
readRefreshTokens(reader);
|
readRefreshTokens(reader);
|
||||||
} else if (name.equals(SYSTEMSCOPES)) {
|
} else if (name.equals(SYSTEMSCOPES)) {
|
||||||
readSystemScopes(reader);
|
readSystemScopes(reader);
|
||||||
|
//reader.skipValue();
|
||||||
} else {
|
} else {
|
||||||
// unknown token, skip it
|
// unknown token, skip it
|
||||||
reader.skipValue();
|
reader.skipValue();
|
||||||
|
@ -566,7 +567,9 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
Long authHolderId = null;
|
Long authHolderId = null;
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if (name.equals("id")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("id")) {
|
||||||
currentId = reader.nextLong();
|
currentId = reader.nextLong();
|
||||||
} else if (name.equals("expiration")) {
|
} else if (name.equals("expiration")) {
|
||||||
if (reader.peek() == JsonToken.NULL) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
@ -623,7 +626,9 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
Long idTokenId = null;
|
Long idTokenId = null;
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if (name.equals("id")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("id")) {
|
||||||
currentId = reader.nextLong();
|
currentId = reader.nextLong();
|
||||||
} else if (name.equals("expiration")) {
|
} else if (name.equals("expiration")) {
|
||||||
if (reader.peek() == JsonToken.NULL) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
@ -689,8 +694,14 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
Long currentId = null;
|
Long currentId = null;
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
|
switch (reader.peek()) {
|
||||||
|
case END_OBJECT:
|
||||||
|
continue;
|
||||||
|
case NAME:
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if(name.equals("id")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("id")) {
|
||||||
currentId = reader.nextLong();
|
currentId = reader.nextLong();
|
||||||
} else if (name.equals("ownerId")) {
|
} else if (name.equals("ownerId")) {
|
||||||
//not needed
|
//not needed
|
||||||
|
@ -700,14 +711,26 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
Authentication userAuthentication = null;
|
Authentication userAuthentication = null;
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
if (name.equals("clientAuthorization")) {
|
switch (reader.peek()) {
|
||||||
|
case END_OBJECT:
|
||||||
|
continue;
|
||||||
|
case NAME:
|
||||||
|
String subName = reader.nextName();
|
||||||
|
if (subName.equals("clientAuthorization")) {
|
||||||
clientAuthorization = readAuthorizationRequest(reader);
|
clientAuthorization = readAuthorizationRequest(reader);
|
||||||
} else if (name.equals("userAuthentication")) {
|
} else if (subName.equals("userAuthentication")) {
|
||||||
userAuthentication = base64UrlDecodeObject(reader.nextString(), Authentication.class);
|
String authString = reader.nextString();
|
||||||
|
userAuthentication = base64UrlDecodeObject(authString, Authentication.class);
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Found unexpected entry");
|
logger.debug("Found unexpected entry");
|
||||||
reader.skipValue();
|
reader.skipValue();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.debug("Found unexpected entry");
|
||||||
|
reader.skipValue();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
OAuth2Authentication auth = new OAuth2Authentication(clientAuthorization, userAuthentication);
|
OAuth2Authentication auth = new OAuth2Authentication(clientAuthorization, userAuthentication);
|
||||||
|
@ -716,6 +739,12 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
logger.debug("Found unexpected entry");
|
logger.debug("Found unexpected entry");
|
||||||
reader.skipValue();
|
reader.skipValue();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.debug("Found unexpected entry");
|
||||||
|
reader.skipValue();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
Long newId = authHolderRepository.save(ahe).getId();
|
Long newId = authHolderRepository.save(ahe).getId();
|
||||||
|
@ -738,8 +767,14 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
String clientId = null;
|
String clientId = null;
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
|
switch (reader.peek()) {
|
||||||
|
case END_OBJECT:
|
||||||
|
continue;
|
||||||
|
case NAME:
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if (name.equals("authorizationParameters")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("authorizationParameters")) {
|
||||||
authorizationParameters = readMap(reader);
|
authorizationParameters = readMap(reader);
|
||||||
} else if (name.equals("approvalParameters")) {
|
} else if (name.equals("approvalParameters")) {
|
||||||
approvalParameters = readMap(reader);
|
approvalParameters = readMap(reader);
|
||||||
|
@ -767,6 +802,12 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
} else {
|
} else {
|
||||||
reader.skipValue();
|
reader.skipValue();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.debug("Found unexpected entry");
|
||||||
|
reader.skipValue();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
DefaultAuthorizationRequest dar = new DefaultAuthorizationRequest(authorizationParameters, approvalParameters, clientId, scope);
|
DefaultAuthorizationRequest dar = new DefaultAuthorizationRequest(authorizationParameters, approvalParameters, clientId, scope);
|
||||||
|
@ -792,8 +833,14 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
Long currentId = null;
|
Long currentId = null;
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
|
switch (reader.peek()) {
|
||||||
|
case END_OBJECT:
|
||||||
|
continue;
|
||||||
|
case NAME:
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if (name.equals("id")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("id")) {
|
||||||
currentId = reader.nextLong();
|
currentId = reader.nextLong();
|
||||||
} else if (name.equals("accessDate")) {
|
} else if (name.equals("accessDate")) {
|
||||||
if (reader.peek() == JsonToken.NULL) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
@ -850,6 +897,12 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
logger.debug("Found unexpected entry");
|
logger.debug("Found unexpected entry");
|
||||||
reader.skipValue();
|
reader.skipValue();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.debug("Found unexpected entry");
|
||||||
|
reader.skipValue();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
approvedSiteRepository.save(site).getId();
|
approvedSiteRepository.save(site).getId();
|
||||||
|
@ -872,8 +925,14 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
ClientDetailsEntity client = new ClientDetailsEntity();
|
ClientDetailsEntity client = new ClientDetailsEntity();
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
while (reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
|
switch (reader.peek()) {
|
||||||
|
case END_OBJECT:
|
||||||
|
continue;
|
||||||
|
case NAME:
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if (name.equals("clientId")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("clientId")) {
|
||||||
client.setClientId(reader.nextString());
|
client.setClientId(reader.nextString());
|
||||||
} else if (name.equals("resourceIds")) {
|
} else if (name.equals("resourceIds")) {
|
||||||
Set<String> resourceIds = readSet(reader);
|
Set<String> resourceIds = readSet(reader);
|
||||||
|
@ -917,7 +976,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
client.setGrantTypes(grantTypes);
|
client.setGrantTypes(grantTypes);
|
||||||
} else if (name.equals("responseTypes")) {
|
} else if (name.equals("responseTypes")) {
|
||||||
Set<String> responseTypes = readSet(reader);
|
Set<String> responseTypes = readSet(reader);
|
||||||
client.setGrantTypes(responseTypes);
|
client.setResponseTypes(responseTypes);
|
||||||
} else if (name.equals("policyUri")) {
|
} else if (name.equals("policyUri")) {
|
||||||
client.setPolicyUri(reader.nextString());
|
client.setPolicyUri(reader.nextString());
|
||||||
} else if (name.equals("applicationType")) {
|
} else if (name.equals("applicationType")) {
|
||||||
|
@ -966,6 +1025,12 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
logger.debug("Found unexpected entry");
|
logger.debug("Found unexpected entry");
|
||||||
reader.skipValue();
|
reader.skipValue();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.debug("Found unexpected entry");
|
||||||
|
reader.skipValue();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.endObject();
|
reader.endObject();
|
||||||
clientRepository.saveClient(client);
|
clientRepository.saveClient(client);
|
||||||
|
@ -991,7 +1056,9 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
continue;
|
continue;
|
||||||
case NAME:
|
case NAME:
|
||||||
String name = reader.nextName();
|
String name = reader.nextName();
|
||||||
if (name.equals("value")) {
|
if (reader.peek() == JsonToken.NULL) {
|
||||||
|
reader.skipValue();
|
||||||
|
} else if (name.equals("value")) {
|
||||||
scope.setValue(reader.nextString());
|
scope.setValue(reader.nextString());
|
||||||
} else if (name.equals("description")) {
|
} else if (name.equals("description")) {
|
||||||
scope.setDescription(reader.nextString());
|
scope.setDescription(reader.nextString());
|
||||||
|
|
Loading…
Reference in New Issue