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

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

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

import java.util.function.Function;

import io.quarkus.security.identity.SecurityIdentity;
import io.smallrye.mutiny.Uni;
import io.vertx.ext.web.RoutingContext;

/**
 * permission checker that checks if the user is authenticated
 */
public class AuthenticatedHttpSecurityPolicy implements HttpSecurityPolicy {

    @Override
    public Uni checkPermission(RoutingContext request, Uni identity,
            AuthorizationRequestContext requestContext) {
        return identity.map(new Function() {
            @Override
            public CheckResult apply(SecurityIdentity identity) {
                return identity.isAnonymous() ? CheckResult.DENY : CheckResult.PERMIT;
            }
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy