{"id":22787350,"url":"https://github.com/aserto-dev/aserto-java","last_synced_at":"2025-07-11T14:38:02.529Z","repository":{"id":153646120,"uuid":"613376838","full_name":"aserto-dev/aserto-java","owner":"aserto-dev","description":"Java library for Aserto services","archived":false,"fork":false,"pushed_at":"2025-04-11T11:11:40.000Z","size":129,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T23:52:43.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aserto-dev.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,"zenodo":null}},"created_at":"2023-03-13T13:04:54.000Z","updated_at":"2025-04-11T11:11:43.000Z","dependencies_parsed_at":"2023-09-26T19:02:37.758Z","dependency_job_id":"b20685e6-abde-4e5e-b4e6-bf427dd97b9b","html_url":"https://github.com/aserto-dev/aserto-java","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/aserto-dev/aserto-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Faserto-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Faserto-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Faserto-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Faserto-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aserto-dev","download_url":"https://codeload.github.com/aserto-dev/aserto-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Faserto-java/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264833291,"owners_count":23670617,"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":[],"created_at":"2024-12-12T00:54:19.199Z","updated_at":"2025-07-11T14:38:02.507Z","avatar_url":"https://github.com/aserto-dev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aserto Java\n[![slack](https://img.shields.io/badge/slack-Aserto%20Community-brightgreen)](https://asertocommunity.slack.com)\n\nJava library for Aserto services\n\n\u003e **Warning**\n\u003e \n\u003e **0.31.1** is the latest version published to maven central. Versions starting with 1.0.z have been removed from maven central and are no longer available for download.\n\n### Build\n`mvn clean install`\n\n### Add the client to your project\n- add the fallowing dependency to your `pom.xml` file\n```maven\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.aserto\u003c/groupId\u003e\n    \u003cartifactId\u003easerto-java\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n\n### Run unit tests\n```\nmvn clean test\n```\n\n### Run integration tests\nIn order to run integration tests we need to have [topaz](https://github.com/aserto-dev/topaz) installed\n```bash\ngo install github.com/topaz/cmd/topaz@latest\ntopaz install\n```\n\nThe integration tests start topaz and configure it for testing. The tests will fail if topaz is not installed.\nIf you have topaz configured, no worries, the tests will save the configuration and restore it after the integration tests are finished.\nTo run the integration tests use the fallowing command:\n```\nmvn test -Pintegration\n```\n\n### Release the project on maven central\n```bash\nmvn clean deploy -Dgpg.passphrase=\"\u003cgpg-passphrase\u003e\" -Pci-cd\n```\n\n## Authorization Example\nStart [topaz](https://github.com/aserto-dev/topaz)\n\n```java\n// create a channel that has the connection details\nManagedChannel channel = new ChannelBuilder()\n        .withHost(\"localhost\")\n        .withPort(8282)\n        .withInsecure(true)\n        .build();\n\n// create authz client\nAuthorizerClient authzClient = new AuthzClient(channel);\n\n// identity context contains information abou the user that requests access to some resource\nIdentityCtx identityCtx = new IdentityCtx(\"rick@the-citadel.com\", IdentityType.IDENTITY_TYPE_SUB);\n\n// contains information about the policy we want to check for the provided identity\nPolicyCtx policyCtx = new PolicyCtx(\"todo\", \"todo\", \"todoApp.DELETE.todos.__id\", new String[]{\"allowed\"});\n\n// check if the identity is allowed to perform the action\nList\u003cDecision\u003e decisions = authzClient.is(identityCtx, policyCtx);\nauthzClient.close();\n\ndecisions.forEach(decision -\u003e {\n    String dec = decision.getDecision();\n    boolean isAllowed =  decision.getIs();\n    System.out.println(\"For decision [\" + dec + \"] the answer was [\" + isAllowed + \"]\");\n});\n```\nFor more examples have a look in the [examples](examples) folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faserto-dev%2Faserto-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faserto-dev%2Faserto-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faserto-dev%2Faserto-java/lists"}