All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.security.deployment.AdditionalDenyingUnannotatedTransformer Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package io.quarkus.security.deployment;

import static io.quarkus.security.deployment.SecurityProcessor.createMethodDescription;
import static io.quarkus.security.deployment.SecurityTransformerUtils.DENY_ALL;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import org.jboss.jandex.AnnotationTarget;

import io.quarkus.arc.processor.AnnotationsTransformer;
import io.quarkus.security.spi.runtime.MethodDescription;

public class AdditionalDenyingUnannotatedTransformer implements AnnotationsTransformer {

    private final Set methods;

    public AdditionalDenyingUnannotatedTransformer(Collection methods) {
        this.methods = new HashSet<>(methods);
    }

    @Override
    public boolean appliesTo(AnnotationTarget.Kind kind) {
        return kind == AnnotationTarget.Kind.METHOD;
    }

    @Override
    public void transform(TransformationContext context) {
        MethodDescription methodDescription = createMethodDescription(context.getTarget().asMethod());
        if (methods.contains(methodDescription)) {
            context.transform().add(DENY_ALL).done();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy