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

org.tkit.quarkus.rs.context.principal.RestContextPrincipalNameConfig Maven / Gradle / Ivy

There is a newer version: 2.36.0
Show newest version
package org.tkit.quarkus.rs.context.principal;

import java.util.Optional;

import io.quarkus.runtime.annotations.*;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

@StaticInitSafe
@ConfigDocFilename("tkit-quarkus-rest-context.adoc")
@ConfigMapping(prefix = "tkit.rs.context")
@ConfigRoot(phase = ConfigPhase.RUN_TIME)
public interface RestContextPrincipalNameConfig {

    /**
     * Rest context principal name configuration.
     */
    @WithName("principal.name")
    PrincipalNameConfig principalName();

    interface PrincipalNameConfig {
        /**
         * Enable or disable principal name resolver.
         */
        @WithName("enabled")
        @WithDefault("true")
        boolean enabled();

        /**
         * Make the principal name mandatory (not null).
         */
        @WithName("mandatory")
        @WithDefault("false")
        boolean mandatory();

        /**
         * Enabled custom service.
         */
        @WithName("custom-service-enabled")
        @WithDefault("false")
        boolean enabledCustomService();

        /**
         * Enable security context for principal name resolver.
         */
        @WithName("security-context")
        SecurityContextConfig securityContext();

        /**
         * Default principal.
         */
        @WithName("default")
        Optional defaultPrincipal();

        /**
         * Enable principal from token.
         */
        @WithName("token-enabled")
        @WithDefault("true")
        boolean tokenEnabled();

        /**
         * Principal from token claim.
         */
        @WithName("token-claim-name")
        @WithDefault("sub")
        String tokenClaimName();

        /**
         * Enable principal from header parameter
         */
        @WithName("header-param-enabled")
        @WithDefault("false")
        boolean headerParamEnabled();

        /**
         * Principal from header parameter
         */
        @WithName("header-param-name")
        @WithDefault("x-principal-id")
        String headerParamName();

    }

    interface SecurityContextConfig {

        /**
         * Enable or disable principal from security context.
         */
        @WithName("enabled")
        @WithDefault("false")
        boolean enabled();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy