{"id":20239139,"url":"https://github.com/kevinmichaelchen/cedar-agent-go-sdk","last_synced_at":"2026-05-12T09:38:28.979Z","repository":{"id":192113022,"uuid":"686062098","full_name":"kevinmichaelchen/cedar-agent-go-sdk","owner":"kevinmichaelchen","description":"Go SDK for Cedar Agent 🌲","archived":false,"fork":false,"pushed_at":"2024-04-05T07:41:38.000Z","size":207,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T22:43:39.075Z","etag":null,"topics":["cedar"],"latest_commit_sha":null,"homepage":"https://kevinmichaelchen.github.io/cedar-agent-go-sdk/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kevinmichaelchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-01T16:42:10.000Z","updated_at":"2024-10-03T02:06:15.000Z","dependencies_parsed_at":"2024-01-06T21:30:51.254Z","dependency_job_id":null,"html_url":"https://github.com/kevinmichaelchen/cedar-agent-go-sdk","commit_stats":null,"previous_names":["kevinmichaelchen/cedar-agent-go-sdk"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinmichaelchen%2Fcedar-agent-go-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinmichaelchen%2Fcedar-agent-go-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinmichaelchen%2Fcedar-agent-go-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinmichaelchen%2Fcedar-agent-go-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinmichaelchen","download_url":"https://codeload.github.com/kevinmichaelchen/cedar-agent-go-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241686817,"owners_count":20003112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cedar"],"created_at":"2024-11-14T08:37:35.555Z","updated_at":"2026-05-12T09:38:23.955Z","avatar_url":"https://github.com/kevinmichaelchen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cedar-agent-go-sdk\n\n[![GoReportCard example](https://goreportcard.com/badge/github.com/kevinmichaelchen/cedar-agent-go-sdk)](https://goreportcard.com/report/github.com/kevinmichaelchen/cedar-agent-go-sdk)\n[![GoDoc reference example](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/kevinmichaelchen/cedar-agent-go-sdk)\n[![version](https://img.shields.io/github/v/release/kevinmichaelchen/cedar-agent-go-sdk?include_prereleases\u0026label=latest\u0026logo=ferrari)](https://github.com/kevinmichaelchen/cedar-agent-go-sdk/releases/latest)\n[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/kevinmichaelchen/cedar-agent-go-sdk)](https://codeclimate.com/github/kevinmichaelchen/cedar-agent-go-sdk)\n\n[Cedar Agent][cedar-agent] is an HTTP Server that runs the [Cedar][cedar] authorization engine.\n\nIt's the easiest way to get up and running with Cedar locally, offering a REST API for managing your entities and policies, as well as policy evaluation.\n\nCedar lets you answer the question: _Is this **user** (principal) allowed to perform this **action** on this **resource**?_\n\n[cedar-agent]: https://github.com/permitio/cedar-agent\n[cedar]: https://www.cedarpolicy.com\n\n## Installation\n\n```shell\ngo get -u github.com/kevinmichaelchen/cedar-agent-go-sdk\n```\n\n## Usage\n\n### Creating a client\n\n```go\npackage main\n\nimport (\n\t\"github.com/kevinmichaelchen/cedar-agent-go-sdk/sdk\"\n\t\"net/http\"\n)\n\nfunc initClient() *sdk.Client {\n\tc := \u0026http.Client{}\n\n\t// The options are entirely ... optional 🙂\n\treturn sdk.NewClient(c,\n\t\tsdk.WithBaseURL(\"http://localhost:8180\"),\n\t\tsdk.WithParallelizationFactor(3),\n\t)\n}\n```\n\n### Performing authorization checks\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/kevinmichaelchen/cedar-agent-go-sdk/sdk\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclient := initClient()\n\tallowed := isAuthorized(ctx, client,\n\t\tsdk.CheckRequest{\n\t\t\tPrincipal: `User::\"42\"`,\n\t\t\tAction: \"viewFoobar\",\n\t\t\tResource: `Foobar::\"101\"`,\n\t\t},\n\t)\n\tfmt.Printf(\"allowed: %t\", allowed)\n}\n\nfunc isAuthorized(ctx context.Context, client *sdk.Client, r sdk.CheckRequest) bool {\n\tres, err := client.Check(ctx, r)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn res.Allowed\n}\n```\n\n### Authorizing a batch\n\nSometimes you want to authorize a principal against multiple resources, \npotentially with multiple actions.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/kevinmichaelchen/cedar-agent-go-sdk/sdk\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclient := initClient()\n\n\tprincipal := `User::\"42\"`\n\n\trequests := map[sdk.Action][]sdk.Resource{\n\t\t\"viewFoo\": {\n\t\t\t`Foo::\"12\"`,\n\t\t\t`Foo::\"39\"`,\n\t\t\t`Foo::\"72\"`,\n\t\t},\n\t\t\"viewBar\": {\n\t\t\t`Bar::\"12\"`,\n\t\t},\n\t}\n\n\tout, err := client.CheckBatch(ctx, principal, requests, 5)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfor req, decision := range out {\n\t\tfmt.Printf(\"request: %v, decision: %t\", req, decision.Allowed)\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinmichaelchen%2Fcedar-agent-go-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinmichaelchen%2Fcedar-agent-go-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinmichaelchen%2Fcedar-agent-go-sdk/lists"}