Search in sources :

Example 1 with OAuthFlowsImpl

use of org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowsImpl in project wildfly-swarm by wildfly-swarm.

the class OpenApiParser method readOAuthFlows.

/**
 * Reads a {@link OAuthFlows} OpenAPI node.
 * @param node
 */
private OAuthFlows readOAuthFlows(JsonNode node) {
    if (node == null || !node.isObject()) {
        return null;
    }
    OAuthFlowsImpl model = new OAuthFlowsImpl();
    model.setImplicit(readOAuthFlow(node.get(OpenApiConstants.PROP_IMPLICIT)));
    model.setPassword(readOAuthFlow(node.get(OpenApiConstants.PROP_PASSWORD)));
    model.setClientCredentials(readOAuthFlow(node.get(OpenApiConstants.PROP_CLIENT_CREDENTIALS)));
    model.setAuthorizationCode(readOAuthFlow(node.get(OpenApiConstants.PROP_AUTHORIZATION_CODE)));
    readExtensions(node, model);
    return model;
}
Also used : OAuthFlowsImpl(org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowsImpl)

Example 2 with OAuthFlowsImpl

use of org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowsImpl in project wildfly-swarm by wildfly-swarm.

the class OpenApiAnnotationScanner method readOAuthFlows.

/**
 * Reads an OAuthFlows annotation into a model.
 * @param value
 */
private OAuthFlows readOAuthFlows(AnnotationValue value) {
    if (value == null) {
        return null;
    }
    LOG.debug("Processing a single @OAuthFlows annotation.");
    AnnotationInstance annotation = value.asNested();
    OAuthFlows flows = new OAuthFlowsImpl();
    flows.setImplicit(readOAuthFlow(annotation.value(OpenApiConstants.PROP_IMPLICIT)));
    flows.setPassword(readOAuthFlow(annotation.value(OpenApiConstants.PROP_PASSWORD)));
    flows.setClientCredentials(readOAuthFlow(annotation.value(OpenApiConstants.PROP_CLIENT_CREDENTIALS)));
    flows.setAuthorizationCode(readOAuthFlow(annotation.value(OpenApiConstants.PROP_AUTHORIZATION_CODE)));
    return flows;
}
Also used : OAuthFlowsImpl(org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowsImpl) OAuthFlows(org.eclipse.microprofile.openapi.models.security.OAuthFlows) AnnotationInstance(org.jboss.jandex.AnnotationInstance)

Aggregations

OAuthFlowsImpl (org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowsImpl)2 OAuthFlows (org.eclipse.microprofile.openapi.models.security.OAuthFlows)1 AnnotationInstance (org.jboss.jandex.AnnotationInstance)1