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

io.quarkus.vertx.http.runtime.security.HttpAuthorizer Maven / Gradle / Ivy

The newest version!
package io.quarkus.vertx.http.runtime.security;

import java.util.ArrayList;
import java.util.List;

import jakarta.enterprise.event.Event;
import jakarta.enterprise.inject.Instance;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.inject.Singleton;

import org.eclipse.microprofile.config.inject.ConfigProperty;

import io.quarkus.security.identity.IdentityProviderManager;
import io.quarkus.security.spi.runtime.AuthorizationController;
import io.quarkus.security.spi.runtime.AuthorizationFailureEvent;
import io.quarkus.security.spi.runtime.AuthorizationSuccessEvent;
import io.quarkus.security.spi.runtime.BlockingSecurityExecutor;

/**
 * Class that is responsible for running the HTTP based permission checks
 */
@Singleton
public final class HttpAuthorizer extends AbstractHttpAuthorizer {

    HttpAuthorizer(HttpAuthenticator httpAuthenticator, IdentityProviderManager identityProviderManager,
            AuthorizationController controller, Instance installedPolicies,
            BlockingSecurityExecutor blockingExecutor, BeanManager beanManager,
            Event authZFailureEvent, Event authZSuccessEvent,
            @ConfigProperty(name = "quarkus.security.events.enabled") boolean securityEventsEnabled) {
        super(httpAuthenticator, identityProviderManager, controller, toList(installedPolicies), beanManager, blockingExecutor,
                authZFailureEvent, authZSuccessEvent, securityEventsEnabled);
    }

    private static List toList(Instance installedPolicies) {
        List globalPolicies = new ArrayList<>();
        for (HttpSecurityPolicy i : installedPolicies) {
            if (i.name() == null && !(i instanceof AbstractPathMatchingHttpSecurityPolicy i1 && i1.hasNoPermissions())) {
                globalPolicies.add(i);
            }
        }
        return globalPolicies;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy