Search in sources :

Example 1 with OAuthFlowImpl

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

the class OpenApiAnnotationScanner method readOAuthFlow.

/**
 * Reads a single OAuthFlow annotation into a model.
 * @param value
 */
private OAuthFlow readOAuthFlow(AnnotationValue value) {
    if (value == null) {
        return null;
    }
    LOG.debug("Processing a single @OAuthFlow annotation.");
    AnnotationInstance annotation = value.asNested();
    OAuthFlow flow = new OAuthFlowImpl();
    flow.setAuthorizationUrl(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_AUTHORIZATION_URL));
    flow.setTokenUrl(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_TOKEN_URL));
    flow.setRefreshUrl(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_REFRESH_URL));
    flow.setScopes(readOAuthScopes(annotation.value(OpenApiConstants.PROP_SCOPES)));
    return flow;
}
Also used : OAuthFlowImpl(org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowImpl) OAuthFlow(org.eclipse.microprofile.openapi.models.security.OAuthFlow) AnnotationInstance(org.jboss.jandex.AnnotationInstance)

Example 2 with OAuthFlowImpl

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

the class OpenApiParser method readOAuthFlow.

/**
 * Reads a {@link OAuthFlow} OpenAPI node.
 * @param node
 */
private OAuthFlow readOAuthFlow(JsonNode node) {
    if (node == null || !node.isObject()) {
        return null;
    }
    OAuthFlowImpl model = new OAuthFlowImpl();
    model.setAuthorizationUrl(JsonUtil.stringProperty(node, OpenApiConstants.PROP_AUTHORIZATION_URL));
    model.setTokenUrl(JsonUtil.stringProperty(node, OpenApiConstants.PROP_TOKEN_URL));
    model.setRefreshUrl(JsonUtil.stringProperty(node, OpenApiConstants.PROP_REFRESH_URL));
    model.setScopes(readScopes(node.get(OpenApiConstants.PROP_SCOPES)));
    readExtensions(node, model);
    return model;
}
Also used : OAuthFlowImpl(org.wildfly.swarm.microprofile.openapi.api.models.security.OAuthFlowImpl)

Aggregations

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