use of com.webauthn4j.metadata.converter.jackson.WebAuthnMetadataJSONModule in project webauthn4j-spring-security by webauthn4j.
the class WebAuthnConfigurerUtil method getObjectConverterOrCreateNew.
/**
* Get {@link ObjectConverter} from SharedObject or ApplicationContext. if nothing hit, create new
*/
public static <H extends HttpSecurityBuilder<H>> ObjectConverter getObjectConverterOrCreateNew(H http) {
ObjectConverter objectConverter = http.getSharedObject(ObjectConverter.class);
if (objectConverter != null) {
return objectConverter;
}
ApplicationContext applicationContext = http.getSharedObject(ApplicationContext.class);
String[] beanNames = applicationContext.getBeanNamesForType(ObjectConverter.class);
if (beanNames.length == 0) {
ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.registerModule(new WebAuthnMetadataJSONModule());
jsonMapper.registerModule(new WebAuthn4JSpringSecurityJSONModule());
ObjectMapper cborMapper = new ObjectMapper(new CBORFactory());
return new ObjectConverter(jsonMapper, cborMapper);
} else {
return applicationContext.getBean(ObjectConverter.class);
}
}
use of com.webauthn4j.metadata.converter.jackson.WebAuthnMetadataJSONModule in project webauthn4j-spring-security by webauthn4j.
the class WebSecurityBeanConfig method objectConverter.
@Bean
public ObjectConverter objectConverter() {
ObjectMapper jsonMapper = new ObjectMapper();
jsonMapper.registerModule(new WebAuthnMetadataJSONModule());
jsonMapper.registerModule(new WebAuthn4JSpringSecurityJSONModule());
ObjectMapper cborMapper = new ObjectMapper(new CBORFactory());
return new ObjectConverter(jsonMapper, cborMapper);
}
Aggregations