Search in sources :

Example 6 with OAuthFlow

use of org.eclipse.microprofile.openapi.models.security.OAuthFlow 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)

Aggregations

OAuthFlow (org.eclipse.microprofile.openapi.models.security.OAuthFlow)6 OAuthFlowImpl (fish.payara.microprofile.openapi.impl.model.security.OAuthFlowImpl)2 Test (org.junit.Test)2 CallbackImpl (fish.payara.microprofile.openapi.impl.model.callbacks.CallbackImpl)1 ExampleImpl (fish.payara.microprofile.openapi.impl.model.examples.ExampleImpl)1 HeaderImpl (fish.payara.microprofile.openapi.impl.model.headers.HeaderImpl)1 ContactImpl (fish.payara.microprofile.openapi.impl.model.info.ContactImpl)1 InfoImpl (fish.payara.microprofile.openapi.impl.model.info.InfoImpl)1 LicenseImpl (fish.payara.microprofile.openapi.impl.model.info.LicenseImpl)1 LinkImpl (fish.payara.microprofile.openapi.impl.model.links.LinkImpl)1 ContentImpl (fish.payara.microprofile.openapi.impl.model.media.ContentImpl)1 DiscriminatorImpl (fish.payara.microprofile.openapi.impl.model.media.DiscriminatorImpl)1 EncodingImpl (fish.payara.microprofile.openapi.impl.model.media.EncodingImpl)1 MediaTypeImpl (fish.payara.microprofile.openapi.impl.model.media.MediaTypeImpl)1 SchemaImpl (fish.payara.microprofile.openapi.impl.model.media.SchemaImpl)1 XMLImpl (fish.payara.microprofile.openapi.impl.model.media.XMLImpl)1 ParameterImpl (fish.payara.microprofile.openapi.impl.model.parameters.ParameterImpl)1 RequestBodyImpl (fish.payara.microprofile.openapi.impl.model.parameters.RequestBodyImpl)1 APIResponseImpl (fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl)1 APIResponsesImpl (fish.payara.microprofile.openapi.impl.model.responses.APIResponsesImpl)1