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
|
||||||
|
@ -699,15 +710,27 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
AuthorizationRequest clientAuthorization = null;
|
AuthorizationRequest clientAuthorization = null;
|
||||||
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);
|
||||||
|
@ -759,7 +794,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
} else if (name.equals("approved")) {
|
} else if (name.equals("approved")) {
|
||||||
approved = reader.nextBoolean();
|
approved = reader.nextBoolean();
|
||||||
} else if (name.equals("denied")) {
|
} else if (name.equals("denied")) {
|
||||||
if(approved == false) {
|
if (approved == false) {
|
||||||
approved = !reader.nextBoolean();
|
approved = !reader.nextBoolean();
|
||||||
}
|
}
|
||||||
} else if (name.equals("redirectUri")) {
|
} else if (name.equals("redirectUri")) {
|
||||||
|
@ -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) {
|
||||||
|
@ -826,7 +873,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
} else if (name.equals("whitelistedSite")) {
|
} else if (name.equals("whitelistedSite")) {
|
||||||
WhitelistedSite wlSite = new WhitelistedSite();
|
WhitelistedSite wlSite = new WhitelistedSite();
|
||||||
reader.beginObject();
|
reader.beginObject();
|
||||||
while(reader.hasNext()) {
|
while (reader.hasNext()) {
|
||||||
String wlName = reader.nextName();
|
String wlName = reader.nextName();
|
||||||
if (wlName.equals("id")) {
|
if (wlName.equals("id")) {
|
||||||
//not needed
|
//not needed
|
||||||
|
@ -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")) {
|
||||||
|
@ -958,14 +1017,20 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
||||||
client.setClientDescription(reader.nextString());
|
client.setClientDescription(reader.nextString());
|
||||||
} else if (name.equals("allowIntrospection")) {
|
} else if (name.equals("allowIntrospection")) {
|
||||||
client.setAllowIntrospection(reader.nextBoolean());
|
client.setAllowIntrospection(reader.nextBoolean());
|
||||||
} else if(name.equals("reuseRefreshToken")) {
|
} else if (name.equals("reuseRefreshToken")) {
|
||||||
client.setReuseRefreshToken(reader.nextBoolean());
|
client.setReuseRefreshToken(reader.nextBoolean());
|
||||||
} else if(name.equals("dynamicallyRegistered")) {
|
} else if (name.equals("dynamicallyRegistered")) {
|
||||||
client.setDynamicallyRegistered(reader.nextBoolean());
|
client.setDynamicallyRegistered(reader.nextBoolean());
|
||||||
} 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();
|
||||||
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