-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ABAC support to OpenFgaClient
- Loading branch information
1 parent
246e75c
commit 6ab7079
Showing
16 changed files
with
253 additions
and
97 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,18 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
groups: | ||
dependencies: | ||
patterns: | ||
- "*" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
groups: | ||
dependencies: | ||
patterns: | ||
- "*" |
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
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
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
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
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
42 changes: 42 additions & 0 deletions
42
src/main/java/dev/openfga/sdk/api/client/ClientRelationshipCondition.java
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,42 @@ | ||
/* | ||
* OpenFGA | ||
* A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. | ||
* | ||
* The version of the OpenAPI document: 0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package dev.openfga.sdk.api.client; | ||
|
||
import dev.openfga.sdk.api.model.RelationshipCondition; | ||
|
||
public class ClientRelationshipCondition { | ||
private String name; | ||
private Object context; | ||
|
||
public ClientRelationshipCondition name(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public ClientRelationshipCondition context(Object context) { | ||
this.context = context; | ||
return this; | ||
} | ||
|
||
public Object getContext() { | ||
return context; | ||
} | ||
|
||
public RelationshipCondition asRelationshipCondition() { | ||
return new RelationshipCondition().name(name).context(context); | ||
} | ||
} |
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
76 changes: 76 additions & 0 deletions
76
src/main/java/dev/openfga/sdk/api/client/ClientTupleKeyWithCondition.java
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,76 @@ | ||
/* | ||
* OpenFGA | ||
* A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar. | ||
* | ||
* The version of the OpenAPI document: 0.1 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package dev.openfga.sdk.api.client; | ||
|
||
import dev.openfga.sdk.api.model.ContextualTupleKeys; | ||
import dev.openfga.sdk.api.model.TupleKey; | ||
import dev.openfga.sdk.api.model.WriteRequestWrites; | ||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
public class ClientTupleKeyWithCondition extends ClientTupleKey { | ||
private ClientRelationshipCondition condition; | ||
|
||
public ClientTupleKeyWithCondition condition(ClientRelationshipCondition condition) { | ||
this.condition = condition; | ||
return this; | ||
} | ||
|
||
public ClientRelationshipCondition getCondition() { | ||
return condition; | ||
} | ||
|
||
public TupleKey asTupleKey() { | ||
var tupleKey = new TupleKey().user(getUser()).relation(getRelation())._object(getObject()); | ||
|
||
if (condition != null) { | ||
tupleKey.condition(condition.asRelationshipCondition()); | ||
} | ||
|
||
return tupleKey; | ||
} | ||
|
||
public static ContextualTupleKeys asContextualTupleKeys(Collection<ClientTupleKeyWithCondition> tupleKeys) { | ||
return new ContextualTupleKeys() | ||
.tupleKeys(tupleKeys.stream() | ||
.map(ClientTupleKeyWithCondition::asTupleKey) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
public static WriteRequestWrites asWriteRequestWrites(Collection<ClientTupleKeyWithCondition> tupleKeys) { | ||
return new WriteRequestWrites() | ||
.tupleKeys(tupleKeys.stream() | ||
.map(ClientTupleKeyWithCondition::asTupleKey) | ||
.collect(Collectors.toList())); | ||
} | ||
|
||
/* Overrides for correct typing */ | ||
|
||
@Override | ||
public ClientTupleKeyWithCondition user(String user) { | ||
super.user(user); | ||
return this; | ||
} | ||
|
||
@Override | ||
public ClientTupleKeyWithCondition relation(String relation) { | ||
super.relation(relation); | ||
return this; | ||
} | ||
|
||
@Override | ||
public ClientTupleKeyWithCondition _object(String _object) { | ||
super._object(_object); | ||
return this; | ||
} | ||
} |
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
Oops, something went wrong.