Search in sources :

Example 1 with SchemaTypeFidoDeviceSerializer

use of org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeFidoDeviceSerializer in project oxTrust by GluuFederation.

the class FidoDeviceCoreLoadingStrategy method load.

@Override
public SchemaType load(AppConfiguration appConfiguration, SchemaType schemaType) throws Exception {
    log.info(" load() ");
    Meta meta = new Meta();
    meta.setLocation(appConfiguration.getBaseEndpoint() + "/scim/v2/Schemas/" + schemaType.getId());
    meta.setResourceType("Schema");
    schemaType.setMeta(meta);
    // Use serializer to walk the class structure
    ObjectMapper mapper = new ObjectMapper();
    mapper.disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS);
    SimpleModule userCoreLoadingStrategyModule = new SimpleModule("FidoDeviceCoreLoadingStrategyModule", new Version(1, 0, 0, ""));
    SchemaTypeFidoDeviceSerializer serializer = new SchemaTypeFidoDeviceSerializer();
    serializer.setSchemaType(schemaType);
    userCoreLoadingStrategyModule.addSerializer(FidoDevice.class, serializer);
    mapper.registerModule(userCoreLoadingStrategyModule);
    mapper.writeValueAsString(createDummyFidoDevice());
    return serializer.getSchemaType();
}
Also used : Meta(org.gluu.oxtrust.model.scim2.Meta) SchemaTypeFidoDeviceSerializer(org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeFidoDeviceSerializer) Version(org.codehaus.jackson.Version) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) SimpleModule(org.codehaus.jackson.map.module.SimpleModule)

Aggregations

Version (org.codehaus.jackson.Version)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 SimpleModule (org.codehaus.jackson.map.module.SimpleModule)1 Meta (org.gluu.oxtrust.model.scim2.Meta)1 SchemaTypeFidoDeviceSerializer (org.gluu.oxtrust.service.scim2.schema.strategy.serializers.SchemaTypeFidoDeviceSerializer)1