private static String getOptionalJsonString(JsonObject jsonObject, String name) { JsonString value = jsonObject.getJsonString(name); if (value == null) { return null; } return value.getString(); }
private JsonPointer getPointer(JsonObject operation, String member) { JsonString pointerString = operation.getJsonString(member); if (pointerString == null) { missingMember(operation.getString("op"), member); } return Json.createPointer(pointerString.getString()); }
private PublicKey resolvePublicKey(JsonObject headers) { JsonString kid = headers.getJsonString("kid"); JsonString jku = headers.getJsonString("jku"); if (kid == null) { if (defaultPublicKey == null) { log.debug("Default public key not configured. Cannot validate token without kid claim."); return null; } return defaultPublicKey; } if (jku != null) { try { return jwkManager.getPublicKey(kid.getString(), new URL(jku.getString())); } catch (MalformedURLException e) { log.debug("Invalid jku URL."); return null; } } else { if (namedKeys.isEmpty()) { log.debug("Cannot validate token with kid claim."); return null; } PublicKey res = namedKeys.get(kid.getString()); if (res == null) { log.debug("Unknown kid."); } return res; } }
@Override protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { FullHttpRequest request = (FullHttpRequest) msg; JsonArray result = Json.createReader(new StringReader(request.content().toString(StandardCharsets.UTF_8))) .readArray(); List<Position> positions = new LinkedList<>(); for (int i = 0; i < result.size(); i++) { JsonObject message = result.getJsonObject(i); JsonString ident = message.getJsonString("ident"); if (ident == null) { continue; } DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, ident.getString()); if (deviceSession == null) { continue; } Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); decodePosition(message, position); positions.add(position); } sendResponse(channel, HttpResponseStatus.OK); return positions; }
private JsonPointer getPointer(JsonObject operation, String member) { JsonString pointerString = operation.getJsonString(member); if (pointerString == null) { missingMember(operation.getString("op"), member); } return Json.createPointer(pointerString.getString()); }
private static String getOptionalJsonString(JsonObject jsonObject, String name) { JsonString value = jsonObject.getJsonString(name); if (value == null) { return null; } return value.getString(); }
@Override public JsonString toJsonString( Object object ) { return builderFactory.createObjectBuilder().add( "value", object.toString() ).build() .getJsonString( "value" ); }
private void updateParents(File inFile, String name, JsonObject property) { JsonObject items = property.getJsonObject("items"); JsonObject typeObj = items == null ? property : items; JsonString refObj = typeObj.getJsonString("$ref"); if (refObj != null) { String ref = refObj.getString(); ParentRef parentRefs = parents.get(ref); if (parentRefs == null) { parents.put(ref, parentRefs = new ParentRef(name)); } parentRefs.schemas.add(inFile.getName()); } }
@Override protected JsonString deserialize(String jsonValue, Unmarshaller unmarshaller, Type rtType) { final JsonBuilderFactory factory = unmarshaller.getJsonbContext().getJsonProvider().createBuilderFactory(null); final JsonObject jsonObject = factory.createObjectBuilder() .add("json", jsonValue) .build(); return jsonObject.getJsonString("json"); } }
@Override public void initialize() throws Exception { settings = JavaxJsonSettings.orDefault( descriptor.metaInfo( JavaxJsonSettings.class ) ); emptyJsonString = jsonFactories.builderFactory().createObjectBuilder().add( "s", "" ).build() .getJsonString( "s" ); }
private JsonPointer getPointer(JsonObject operation, String member) { JsonString pointerString = operation.getJsonString(member); if (pointerString == null) { missingMember(operation.getString("op"), member); } return Json.createPointer(pointerString.getString()); }
private JsonPointer getPointer(JsonObject operation, String member) { JsonString pointerString = operation.getJsonString(member); if (pointerString == null) { missingMember(operation.getString("op"), member); } return Json.createPointer(pointerString.getString()); }
private JsonPointer getPointer(JsonObject operation, String member) { JsonString pointerString = operation.getJsonString(member); if (pointerString == null) { missingMember(operation.getString("op"), member); } return Json.createPointer(pointerString.getString()); }
/** * Reads the person's email address. * * @param src The JSON object to read the value into. * @param person The source object. */ private void readEmail(@Nonnull JsonObject src, @Nonnull Person person) { final JsonString stringProperty = src.getJsonString(EMAIL_PROP); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringProperty)) { person.setEmail(stringProperty.getString()); } }
/** * Reads the application id for subject grant. * * @param src The JSON object to read the value into. * @param grantType The ClientSecretGrantType object. */ private void readAppId(@Nonnull JsonObject src, @Nonnull ClientSecretGrantType grantType) { final JsonString stringValue = src.getJsonString(PROP_APPLICATION_ID); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringValue)) { grantType.setAppId(stringValue.getString()); } }
/** * Reads the application id for subject grant. * * @param src The JSON object to read the value into. * @param grantType The ClientSecretGrantType object. */ private void readAppId(@Nonnull JsonObject src, @Nonnull CertificateGrantType grantType) { final JsonString stringValue = src.getJsonString(PROP_APPLICATION_ID); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringValue)) { grantType.setAppId(stringValue.getString()); } }
/** * Reads the person's sur name. * * @param src The JSON object to read the value into. * @param person The source object. */ private void readSurName(@Nonnull JsonObject src, @Nonnull Person person) { final JsonString stringProperty = src.getJsonString(SURNAME_PROP); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringProperty)) { person.setSurname(stringProperty.getString()); } }
/** * Reads the client secret for subject grant. * * @param src The JSON object to read the value into. * @param grantType The ClientSecretGrantType object. */ private void readClientSecret(@Nonnull JsonObject src, @Nonnull ClientSecretGrantType grantType) { final JsonString stringValue = src.getJsonString(PROP_CLIENT_SECRET); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringValue)) { grantType.setClientSecret(stringValue.getString()); } }
/** * Reads the public key. * * @param src The JSON object to read the value into. * @param grantType The CertificateGrantType object. */ private void readPublicKey(@Nonnull JsonObject src, @Nonnull CertificateGrantType grantType) { final JsonString stringValue = src.getJsonString(PROP_PUBLIC_KEY); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringValue)) { grantType.setPubKey(stringValue.getString()); } }
/** * Reads the person's given name. * * @param src The JSON object to read the value into. * @param person The source object. */ private void readGivenName(@Nonnull JsonObject src, @Nonnull Person person) { final JsonString stringProperty = src.getJsonString(GIVEN_NAME_PROP); if (!JsonpSupport.isJsonStringPropertyEmptyOrNull(stringProperty)) { person.setGivenName(stringProperty.getString()); } }