OpenFGA
Check authorization against an OpenFGA store, list and read its relationships, and write or delete relationship tuples.
What’s inside
-
OpenFGA component, URI syntax:
openfga:operation
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-openfga-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 46 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.openfga.api-audience | The audience to request the access token for in the client-credentials flow. | String | |
camel.component.openfga.api-token | Pre-shared key sent to OpenFGA as a Bearer token in the Authorization header, for a server started with --authn-method preshared. Takes precedence over clientId. | String | |
camel.component.openfga.api-token-issuer | The token endpoint of the OAuth 2.0 client-credentials flow, for example https://issuer.example.com/oauth/token. The SDK adds https:// when no scheme is given, and the path /oauth/token when the URL has no path. | String | |
camel.component.openfga.api-url | The base URL of the OpenFGA HTTP API, without a trailing slash, for example http://openfga:8080. The default is OpenFGA on its standard HTTP port on the local host. | String | |
camel.component.openfga.authorization-model-id | The identifier of the authorization model revision to evaluate against. Leave it empty to use whichever model the store considers latest. Pin it in production. A store keeps every model it was ever given and latest moves the moment somebody writes a new one, so an unpinned endpoint can start answering a different question than the one it was reviewed with - without any change to the route. Pinning also makes a model rollout a deliberate, reviewable configuration change. | String | |
camel.component.openfga.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.openfga.batch-check-mode | Whether batchCheck fans out individual checks (client, the compatible default) or uses the native server BatchCheck API (server, requires OpenFGA 1.8.0 or later). Server mode chunks checks by maxBatchSize and correlates responses back to the original objects. Failures never fall back to an unfiltered result or another mode. | client | OpenFgaBatchCheckMode |
camel.component.openfga.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.openfga.change-poll-timeout | How long the readChanges consumer waits for the change log request of one poll before the poll fails. Must be positive. The option is a long type. | 30000 | Long |
camel.component.openfga.checkpoint-key | The key under which the readChanges consumer stores its continuation token in the checkpointRepository. Required for the consumer. Use a key of its own for each consumer: consumers that share a key overwrite each other’s position. | String | |
camel.component.openfga.checkpoint-repository | The StateRepository that stores the continuation token of the change log, so the readChanges consumer resumes where it stopped after a restart. Required for the consumer. The token is saved only after the whole page was routed successfully, so a page that failed is read again. A repository that is not started yet is started and stopped with the consumer. The option is a org.apache.camel.spi.StateRepository<java.lang.String, java.lang.String> type. | String> | |
camel.component.openfga.client-id | Client identifier for the OAuth 2.0 client-credentials flow, for a server that authenticates through an OIDC provider. Setting it (without apiToken) selects that flow, which then requires clientSecret and apiTokenIssuer; apiAudience and scopes are optional. | String | |
camel.component.openfga.client-secret | Client secret for the OAuth 2.0 client-credentials flow. | String | |
camel.component.openfga.condition-context | The context for the conditions (CEL expressions) of conditional relationship tuples, as a Map looked up from the registry, for example #myContext. Used by check, batchCheck, listObjects, streamedListObjects, listRelations and listUsers. Give each value the Java type of its condition parameter: OpenFGA rejects a value of the wrong type with HTTP 400, which fails the exchange also when failOpen is enabled. | Object> | |
camel.component.openfga.configuration | The component configuration. The option is a org.apache.camel.component.openfga.OpenFgaConfiguration type. | OpenFgaConfiguration | |
camel.component.openfga.connect-timeout | How long to wait for the connection to OpenFGA to be established. The component sets it on the Java HttpClient it builds for the SDK. Must be positive. The option is a long type. | 10000 | Long |
camel.component.openfga.consistency | The consistency the query is answered with. OpenFGA’s default, MINIMIZE_LATENCY, may answer from a replica that has not caught up yet, which right after a revoke means a tuple that was deleted can still grant access for a moment. Set HIGHER_CONSISTENCY on the paths where that window matters, at the cost of latency. Left unset, OpenFGA’s own default applies. | String | |
camel.component.openfga.contextual-tuples | Relationship tuples that apply to one query only and are never stored, as semicolon-separated user,relation,object triples, each part a Simple expression, for example user:$\{exchangeProperty.authenticatedSubject},member,team:eng. Used by check, batchCheck, listObjects, streamedListObjects, listRelations and listUsers. A contextual tuple grants access exactly like a stored tuple, so derive it from what the route established, never from a header the caller sent. When a part resolves to blank or to an invalid value, the exchange is denied with the reason invalid-contextual-tuple. | String | |
camel.component.openfga.continuation-token | The page to read from, for readTuples and readChanges. Evaluated as a Simple expression against the exchange, so a route can feed back the token the previous page returned - $\{header.CamelOpenFgaContinuationToken} - and page through without the token being configured statically. | String | |
camel.component.openfga.enabled | Whether to enable auto configuration of the openfga component. This is enabled by default. | Boolean | |
camel.component.openfga.fail-open | Whether to let the exchange proceed when OpenFGA could not answer: the server is unreachable, the request timed out, or it answered HTTP 429 or 5xx. Such an exchange gets CamelOpenFgaAllowed=true and CamelOpenFgaFailedOpen=true. Applies only to the check operation and to OpenFgaSecurityPolicy; a deny, a subject or object that could not be used, and any other error are never turned into an allow, and the other operations always fail. Do not enable this in production. | false | Boolean |
camel.component.openfga.health-check-consumer-enabled | Used for enabling or disabling all consumer based health checks from this component | true | Boolean |
camel.component.openfga.health-check-producer-enabled | Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true. | true | Boolean |
camel.component.openfga.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.openfga.max-batch-size | Maximum number of checks per native server BatchCheck request, from 1 to 50. Applies only when batchCheckMode=server; the SDK splits larger input lists into requests of at most this size. 50 is the default per-request limit of an OpenFGA server (max-checks-per-batch-check). | 50 | Integer |
camel.component.openfga.max-parallel-requests | How many HTTP requests a batchCheck may have in flight at once, at least 1. In client mode each request checks one object; in server mode each request checks up to maxBatchSize objects. | 10 | Integer |
camel.component.openfga.max-retries | How many times the SDK retries a request that failed with a network error, HTTP 429 or a 5xx response other than 501. From 0 (no retries) to 15. More retries also make one exchange wait longer. | 3 | Integer |
camel.component.openfga.object | The object as an OpenFGA identifier such as document:budget, evaluated as a Simple expression against each exchange, so document:$\{header.documentId} names the resource the message is about. It is the object to check for check, listRelations, listUsers and expand, the object of the tuple for writeTuples, deleteTuples and write, and a filter for readTuples, where a type alone such as document: is also accepted. Taking it from a header is safe: the check decides whether the caller may access it. | String | |
camel.component.openfga.on-duplicate | How writeTuples and write handle an existing relationship: error (the default) fails the operation, while ignore leaves that relationship unchanged and continues. The ignore mode requires OpenFGA 1.10.0 or later. | error | OpenFgaWriteConflictMode |
camel.component.openfga.on-missing | How deleteTuples and write handle an absent relationship: error (the default) fails the operation, while ignore skips that deletion and continues. The ignore mode requires OpenFGA 1.10.0 or later. | error | OpenFgaWriteConflictMode |
camel.component.openfga.open-fga-client | An existing OpenFgaClient to use instead of one built by the component. The client then sets the server, store, credentials, TLS and HTTP timeouts, so apiUrl, storeId, the credentials, sslContextParameters, connectTimeout, readTimeout and maxRetries do not configure it; the timeouts and maxRetries still bound how long the component waits for an answer. No producer health check is registered. streamedListObjects also needs streamingClient, storeId and a positive readTimeout. The option is a dev.openfga.sdk.api.client.OpenFgaClient type. | OpenFgaClient | |
camel.component.openfga.page-size | How many entries a readTuples or readChanges page returns. Left unset, OpenFGA’s own default applies. A page is one request: this bounds the answer, not the number of requests a route makes. | Integer | |
camel.component.openfga.read-timeout | How long to wait for one HTTP request to OpenFGA to complete, set as the timeout of each request the SDK sends. Must be positive. A check that times out has no verdict, so the exchange fails, unless failOpen is enabled. The option is a long type. | 10000 | Long |
camel.component.openfga.relation | The relation, such as reader or owner, evaluated as a Simple expression against each exchange. It is the permission demanded by check, batchCheck, listObjects, streamedListObjects, listUsers and expand, the relation of the tuple for writeTuples, deleteTuples and write, and a filter for readTuples. Keep it literal: resolving it from an inbound header lets the caller pick the weakest relation the authorization model defines. | String | |
camel.component.openfga.relations | Comma-separated list of relations the listRelations operation asks about, for example reader,writer,owner. Only the ones the subject actually holds come back. | String | |
camel.component.openfga.scopes | Space-separated scopes to request in the client-credentials flow. | String | |
camel.component.openfga.ssl-context-parameters | TLS configuration for the connection to OpenFGA. Needed to trust a server whose certificate comes from a private CA, and to present a client certificate to a server that requires mutual TLS - a SPIFFE X.509-SVID obtained with camel-spiffe, for instance, so the workload authenticates to the decision point as itself. The option is a org.apache.camel.support.jsse.SSLContextParameters type. | SSLContextParameters | |
camel.component.openfga.start-time | The earliest change readChanges returns, as an ISO-8601 timestamp such as 2026-10-01T00:00:00Z. Without it, reading starts at the beginning of the change log of the store. The consumer uses it only while the checkpointRepository holds no position yet. A malformed value fails the endpoint when it starts. | String | |
camel.component.openfga.store-id | The identifier of the OpenFGA store holding the relationship tuples and the authorization model, as returned by fga store create. The store is the relationship graph that judges the exchange, so it comes from the endpoint only and is never taken from a message header. | String | |
camel.component.openfga.stream-max-line-length | The maximum length, in characters, of one line (one JSON record) of the streamedListObjects response. A longer line fails the iteration. Must be positive. | 65536 | Integer |
camel.component.openfga.stream-max-results | The maximum number of objects streamedListObjects returns. When the server streams more, the iteration fails instead of returning a truncated result. Must be positive. | 10000 | Integer |
camel.component.openfga.streaming-client | The OpenFgaStreamingClient that opens the HTTP request of streamedListObjects. Required when openFgaClient is set; otherwise the component builds one from apiUrl, the credentials and sslContextParameters. The application owns the lifecycle of a client set here. The option is a org.apache.camel.component.openfga.OpenFgaStreamingClient type. | OpenFgaStreamingClient | |
camel.component.openfga.type | The object type from the authorization model, for example document, taken literally. Required for listObjects and streamedListObjects, which list the objects of this type. Optional for readChanges, where it limits the changes to objects of this type. | String | |
camel.component.openfga.use-global-ssl-context-parameters | Enable usage of global SSL context parameters. | false | Boolean |
camel.component.openfga.user | The user (subject) as an OpenFGA identifier such as user:anne, evaluated as a Simple expression against each exchange. It is the subject to authorize for check, batchCheck, listObjects, streamedListObjects and listRelations, the user of the tuple for writeTuples, deleteTuples and write, and a filter for readTuples. Take it from an exchange property set by the step that verified the caller, for example user:$\{exchangeProperty.CamelKeycloakTokenSubject}, and not from a header the caller sent, which would let the caller choose who to be. When it resolves to blank or to a bare type prefix such as user:, the check and list operations deny the exchange (an empty list for the list operations), also when failOpen is enabled. | String | |
camel.component.openfga.user-filters | Comma-separated list of user filters for the listUsers operation, naming which kinds of subject to return. An entry is either a type, user, or a type and a relation, team#member, to return the usersets holding the relation rather than the individual subjects. Defaults to user. | String |