Skip to content
Last updated

Entitlements quickstart

Use Frontegg's Entitlements Engine from JVM applications with a gRPC client. Run feature checks, permission checks, and fine-grained authorization (FGA) from services built with Java or other JVM languages.



Prerequisites

The Entitlements client is the only supported Frontegg SDK for Java today. You need a reachable entitlements engine endpoint, an engine token (for example ENTITLEMENTS_ENGINE_TOKEN), and a project using Maven or Gradle.

Modules and artifacts

Artifacts are published to Maven Central under the group ID com.frontegg.sdk.

ModuleArtifact IDDescription
Coreentitlements-clientgRPC client, check API, fallback, and caching
BOMentitlements-client-bomBill of Materials for aligned dependency versions
Spring Boot starterentitlements-client-spring-boot-starterAuto-configuration from application.properties
Test utilitiesentitlements-client-testMockEntitlementsClient and RecordingEntitlementsClient

Install with Maven (using BOM)

Add BOM import and the core dependency. Replace x.y.z with the current release on Maven Central.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.frontegg.sdk</groupId>
            <artifactId>entitlements-client-bom</artifactId>
            <version>x.y.z</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>com.frontegg.sdk</groupId>
        <artifactId>entitlements-client</artifactId>
    </dependency>
</dependencies>

Install with Gradle (using BOM)

implementation(platform("com.frontegg.sdk:entitlements-client-bom:x.y.z"))
implementation("com.frontegg.sdk:entitlements-client")

Configure and run checks

Build ClientConfiguration with your engine host and token, create an EntitlementsClient, then call isEntitledTo with a user context and either a feature or permission context.


import com.frontegg.sdk.entitlements.EntitlementsClient;
import com.frontegg.sdk.entitlements.EntitlementsClientFactory;
import com.frontegg.sdk.entitlements.config.ClientConfiguration;
import com.frontegg.sdk.entitlements.model.EntitlementsResult;
import com.frontegg.sdk.entitlements.model.FeatureRequestContext;
import com.frontegg.sdk.entitlements.model.PermissionRequestContext;
import com.frontegg.sdk.entitlements.model.UserSubjectContext;

ClientConfiguration config = ClientConfiguration.builder()
        .engineEndpoint("grpc.authz.example.com:443")
        .engineToken(System.getenv("ENTITLEMENTS_ENGINE_TOKEN"))
        .build();

try (EntitlementsClient client = EntitlementsClientFactory.create(config)) {

    EntitlementsResult featureResult = client.isEntitledTo(
            new UserSubjectContext("user-123", "tenant-456"),
            new FeatureRequestContext("advanced-reporting")
    );
    System.out.println(featureResult.result() ? "Access granted" : "Access denied");

    EntitlementsResult permissionResult = client.isEntitledTo(
            new UserSubjectContext("user-123", "tenant-456"),
            new PermissionRequestContext("reports:export")
    );
    if (!permissionResult.result()) {
        throw new AccessDeniedException("Insufficient permissions");
    }
}

Long-running applications

In Spring Boot, Quarkus, Micronaut, or other long-lived processes, register the client as a singleton bean instead of creating it for each request or using try-with-resources per call.

Spring Boot starter

For Spring Boot, add the entitlements-client-spring-boot-starter artifact (via the same BOM) and configure properties in application.properties or application.yml so the client is created automatically. See the repository README for property names and examples.

Resources