Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Initial OpenFgaClientConfig #12

Merged
merged 10 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Checks
jimmyjames marked this conversation as resolved.
Show resolved Hide resolved

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
31 changes: 16 additions & 15 deletions .gitignore
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
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# fga-spring-boot
A Spring Boot Starter for OpenFGA
# OpenFGA Spring Boot Starter

A Spring Boot Starter for OpenFGA.

## Configuration

Configure your application properties:

```yaml
openfga:
api-url: FGA_API_URL
store-id: STORE_ID
authorization-model-id: AUTHORIZATION_MODEL_ID
credentials:
api-token: API-TOKEN # takes precedence if set
jimmyjames marked this conversation as resolved.
Show resolved Hide resolved
client-id: CLIENT_ID
client-secret: CLIENT_SECRET
api-token-issuer: API_TOKEN_ISSUER
api-audience: API_AUDIENCE
scopes: SCOPE1 SCOPE2
```

Your application can then inject the configured `openFgaClient`:

```java
@Service
public class MyService {

@Autowired
private OpenFgaClient openFgaClient;
}
```
49 changes: 49 additions & 0 deletions build.gradle
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 added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
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
Loading