Releases: auth0-lab/fga-go-sdk
v0.7.0
0.7.0 (2024-02-23)
[Breaking]
As of this point this SDK is deprecated and should no longer be used. Please use https://github.com/openfga/go-sdk instead.
We strongly recommend you use the OpenFGA Go SDK directly instead with the following configuration:
For US1 (Production US) environment, use the following values:
- API URL:
https://api.us1.fga.dev
- Credential Method: ClientCredentials
- API Token Issuer:
fga.us.auth0.com
- API Audience:
https://api.us1.fga.dev/
You can get the rest of the necessary variables from the FGA Dashboard. See here.
package main
import (
"os"
. "github.com/openfga/go-sdk/client"
"github.com/openfga/go-sdk/credentials"
)
func main() {
fgaClient, err := NewSdkClient(&ClientConfiguration{
ApiUrl: "https://api.us1.fga.dev",
StoreId: os.Getenv("FGA_STORE_ID"),
AuthorizationModelId: os.Getenv("FGA_MODEL_ID"),
Credentials: &credentials.Credentials{
Method: credentials.CredentialsMethodClientCredentials,
Config: &credentials.Config{
ClientCredentialsClientId: os.Getenv("FGA_CLIENT_ID"),
ClientCredentialsClientSecret: os.Getenv("FGA_CLIENT_SECRET"),
ClientCredentialsApiAudience: "https://api.us1.fga.dev/",
ClientCredentialsApiTokenIssuer: "fga.us.auth0.com",
},
},
})
if err != nil {
// .. Handle error
}
}
v0.6.0
0.6.0 (2022-12-16)
Changes:
- [BREAKING] feat(list-objects)!: response has been changed to include the object type e.g. response that was
{"object_ids":["roadmap"]}
, will now be{"objects":["document:roadmap"]}
Fixes:
- [BREAKING] fix(models)!: update interfaces that had incorrectly optional fields to make them required
Chore:
- chore(deps): update dependencies
v0.5.0
0.5.0 (2022-10-13)
- BREAKING: exported type
TypeDefinitions
is nowWriteAuthorizationModelRequest
Note: This is only a breaking change on the SDK, not the API. - feat: Support for ListObjects API
You call the API and receive the list of object ids from a particular type that the user has a certain relation with.
For example, to find the list of documents that Anne can read:
body := auth0fga.ListObjectsRequest{
AuthorizationModelId: PtrString(""),
User: PtrString("user:anne"),
Relation: PtrString("can_view"),
Type: PtrString("document"),
}
data, response, err := apiClient.Auth0FgaApi.ListObjects(context.Background()).Body(body).Execute()
// response.object_ids = ["roadmap"]
- chore: Use govulncheck in CI to check for issues
- chore(deps): upgrade dependencies
- chore: Target go 1.19
v0.4.0
0.4.0 (2022-06-07)
Changes
- feat!: ReadAuthorizationModels now returns an array of Authorization Models instead of IDs [BREAKING CHANGE]
The response will become similar to:
{
"authorization_models": [
{
"id": (string),
"type_definitions": [...]
}
]
}
-
feat!: drop support for all settings endpoints [BREAKING CHANGE]
-
feat!: Simplify error prefix to
Fga
[BREAKING CHANGE]
Possible Errors:
-
FgaApiError
: All errors returned by the API extend this error -
FgaApiValidationError
: 400 and 422 Validation Errors returned by the API -
FgaApiNotFoundError
: 404 errors returned by the API -
FgaApiRateLimitExceededError
: 429 errors returned by the API -
FgaApiInternalError
: 5xx errors returned by the API -
FgaApiAuthenticationError
: Error during authentication -
feat!: drop
Params
postfix from the name of the request interface [BREAKING CHANGE]
e.g. ReadRequestParams
will become ReadRequest
- feat: add support for contextual tuples in the Check request
You can call them like so:
body := fgaSdk.CheckRequest{
TupleKey: &fgaSdk.TupleKey{
User: fgaSdk.PtrString("anne"),
Relation: fgaSdk.PtrString("can_view"),
Object: fgaSdk.PtrString("transaction:A"),
},
ContextualTuples: &fgaSdk.ContextualTuples{
TupleKeys: []fgaSdk.TupleKey{
{
User: fgaSdk.PtrString("anne"),
Relation: fgaSdk.PtrString("user"),
Object: fgaSdk.PtrString("ip-address-range:10.0.0.0/16"),
},
{
User: fgaSdk.PtrString("anne"),
Relation: fgaSdk.PtrString("user"),
Object: fgaSdk.PtrString("timeslot:18_19"),
}
}
}
}
data, response, err := fgaClient.Auth0FgaApi.Check(context.Background()).Body(body).Execute()
-
chore: upgrade dependencies
-
chore: internal refactor