Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cerbos/cerbos-sdk-ruby
Ruby SDK for authorization via Cerbos
https://github.com/cerbos/cerbos-sdk-ruby
authorization cerbos ruby
Last synced: about 18 hours ago
JSON representation
Ruby SDK for authorization via Cerbos
- Host: GitHub
- URL: https://github.com/cerbos/cerbos-sdk-ruby
- Owner: cerbos
- License: apache-2.0
- Created: 2022-04-28T12:49:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-05T10:27:36.000Z (3 days ago)
- Last Synced: 2024-11-05T11:36:57.781Z (3 days ago)
- Topics: authorization, cerbos, ruby
- Language: Ruby
- Homepage:
- Size: 315 KB
- Stars: 6
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Cerbos Ruby SDK
[![Gem](https://img.shields.io/gem/v/cerbos?style=flat-square)](https://rubygems.org/gems/cerbos)
[![Documentation](https://img.shields.io/badge/yard-docs-blue?style=flat-square)](https://www.rubydoc.info/gems/cerbos)[Cerbos](https://cerbos.dev) helps you super-charge your authorization implementation by writing context-aware access control policies for your application resources.
Author access rules using an intuitive YAML configuration language, use your Git-ops infrastructure to test and deploy them, and make simple API requests to the Cerbos policy decision point (PDP) server to evaluate the policies and make dynamic access decisions.The Cerbos Ruby SDK makes it easy to interact with the Cerbos PDP from your Ruby applications.
## Prerequisites
- Cerbos 0.16+
- Ruby 3.1+## Installation
Install the gem and add it to your application's Gemfile by running
```console
$ bundle add cerbos
```If you're not using Bundler to manage dependencies, install the gem by running
```console
$ gem install cerbos
```## Example usage
```ruby
client = Cerbos::Client.new("localhost:3593", tls: false)decision = client.check_resource(
principal: {
id: "[email protected]",
roles: ["USER"],
},
resource: {
kind: "document",
id: "1",
attr: {
owner: "[email protected]"
}
},
actions: ["view", "edit"]
)decision.allow?("view") # => true
decision.allow?("edit") # => false
```For more details, [see the `Client` documentation](https://www.rubydoc.info/gems/cerbos/Cerbos/Client).
## Further reading
- [API reference](https://www.rubydoc.info/gems/cerbos/Cerbos)
- [Cerbos documentation](https://docs.cerbos.dev)## Get help
- [Join the Cerbos community on Slack](http://go.cerbos.io/slack)
- [Email us at [email protected]](mailto:[email protected])