-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Initial OpenFgaClientConfig (#12)
- Loading branch information
Showing
14 changed files
with
951 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Checks | ||
|
||
on: [pull_request, push] | ||
|
||
jobs: | ||
build: | ||
name: Run Checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the source | ||
uses: actions/checkout@v4 | ||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Run Gradle check task | ||
run: ./gradlew check --continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# exclude jar for gradle wrapper | ||
!gradle/wrapper/*.jar | ||
!**/gradle/wrapper/*.jar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
replay_pid* | ||
|
||
# build files | ||
**/target | ||
target | ||
.gradle | ||
build | ||
|
||
# JetBrains IDEs | ||
.idea/ | ||
*.iml | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,55 @@ | ||
# fga-spring-boot | ||
A Spring Boot Starter for OpenFGA | ||
# OpenFGA Spring Boot Starter | ||
|
||
A Spring Boot Starter for OpenFGA. | ||
|
||
## Configuration | ||
|
||
No authorization: | ||
|
||
```yaml | ||
openfga: | ||
api-url: YOUR_FGA_API_URL | ||
store-id: YOUR_FGA_STORE_ID | ||
authorization-model-id: YOUR_FGA_AUTHORIZATION_MODEL_ID | ||
``` | ||
API token authorization: | ||
```yaml | ||
openfga: | ||
api-url: YOUR_FGA_API_URL | ||
store-id: YOUR_FGA_STORE_ID | ||
authorization-model-id: YOUR_FGA_AUTHORIZATION_MODEL_ID | ||
credentials: | ||
method: API_TOKEN | ||
config: | ||
api-token: YOUR_API_TOKEN | ||
``` | ||
Client credentials authorization: | ||
```yaml | ||
openfga: | ||
api-url: YOUR_FGA_API_URL | ||
store-id: YOUR_FGA_STORE_ID | ||
authorization-model-id: YOUR_FGA_AUTHORIZATION_MODEL_ID | ||
credentials: | ||
method: CLIENT_CONFIGURATION | ||
config: | ||
client-id: YOUR_CLIENT_ID | ||
client-secret: YOUR_CLIENT_SECRET | ||
api-token-issuer: YOUR_API_TOKEN_ISSUER | ||
api-audience: YOUR_API_AUDIENCE | ||
scopes: YOUR_SPACE_SEPERATED_SCOPES | ||
``` | ||
Your application can then inject the configured `openFgaClient`: | ||
|
||
```java | ||
@Service | ||
public class MyService { | ||
@Autowired | ||
private OpenFgaClient openFgaClient; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'org.springframework.boot' version '3.2.2' apply false | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
|
||
id 'maven-publish' | ||
} | ||
|
||
group = "dev.openfga" | ||
version = "0.0.1-SNAPSHOT" | ||
|
||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot' | ||
implementation 'org.springframework.boot:spring-boot-autoconfigure' | ||
api 'dev.openfga:openfga-sdk:0.4.0' | ||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.hamcrest:hamcrest:2.2' | ||
|
||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = "${groupId}" | ||
artifactId = 'openfga-spring-boot-starter' | ||
version = "${version}" | ||
|
||
from components.java | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.