use of org.wildfly.swarm.microprofile.openapi.api.models.security.SecuritySchemeImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiParser method readSecurityScheme.
/**
* Reads a {@link SecurityScheme} OpenAPI node.
* @param node
*/
private SecurityScheme readSecurityScheme(JsonNode node) {
if (node == null || !node.isObject()) {
return null;
}
SecuritySchemeImpl model = new SecuritySchemeImpl();
model.setRef(JsonUtil.stringProperty(node, OpenApiConstants.PROP_$REF));
model.setType(readSecuritySchemeType(node.get(OpenApiConstants.PROP_TYPE)));
model.setDescription(JsonUtil.stringProperty(node, OpenApiConstants.PROP_DESCRIPTION));
model.setName(JsonUtil.stringProperty(node, OpenApiConstants.PROP_NAME));
model.setIn(readSecuritySchemeIn(node.get(OpenApiConstants.PROP_IN)));
model.setScheme(JsonUtil.stringProperty(node, OpenApiConstants.PROP_SCHEME));
model.setBearerFormat(JsonUtil.stringProperty(node, OpenApiConstants.PROP_BEARER_FORMAT));
model.setFlows(readOAuthFlows(node.get(OpenApiConstants.PROP_FLOWS)));
model.setOpenIdConnectUrl(JsonUtil.stringProperty(node, OpenApiConstants.PROP_OPEN_ID_CONNECT_URL));
readExtensions(node, model);
return model;
}
use of org.wildfly.swarm.microprofile.openapi.api.models.security.SecuritySchemeImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiAnnotationScanner method readSecurityScheme.
/**
* Reads a SecurityScheme annotation into a model.
* @param annotation
*/
private SecurityScheme readSecurityScheme(AnnotationInstance annotation) {
if (annotation == null) {
return null;
}
LOG.debug("Processing a single @SecurityScheme annotation.");
SecurityScheme securityScheme = new SecuritySchemeImpl();
securityScheme.setType(JandexUtil.enumValue(annotation, OpenApiConstants.PROP_TYPE, org.eclipse.microprofile.openapi.models.security.SecurityScheme.Type.class));
securityScheme.setDescription(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_DESCRIPTION));
securityScheme.setName(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_API_KEY_NAME));
securityScheme.setIn(JandexUtil.enumValue(annotation, OpenApiConstants.PROP_IN, org.eclipse.microprofile.openapi.models.security.SecurityScheme.In.class));
securityScheme.setScheme(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_SCHEME));
securityScheme.setBearerFormat(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_BEARER_FORMAT));
securityScheme.setFlows(readOAuthFlows(annotation.value(OpenApiConstants.PROP_FLOWS)));
securityScheme.setOpenIdConnectUrl(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_OPEN_ID_CONNECT_URL));
securityScheme.setRef(JandexUtil.refValue(annotation, RefType.SecurityScheme));
return securityScheme;
}
Aggregations