All Projects → wilddima → pundit_kit

wilddima / pundit_kit

Licence: MIT license
Extension for pundit which allows to describe namespaces of policies in routes-like style

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to pundit kit

graphql authorize
Authorization helpers for ruby-graphql fields
Stars: ✭ 23 (+91.67%)
Mutual labels:  authorization, pundit
authorize-me
Authorization with social networks
Stars: ✭ 44 (+266.67%)
Mutual labels:  authorization
raider
OWASP Raider: a novel framework for manipulating the HTTP processes of persistent sessions
Stars: ✭ 88 (+633.33%)
Mutual labels:  authorization
react-redux-jwt-auth
React Redux: Token Authentication example with JWT, React Router, Axios, Thunk Middleware
Stars: ✭ 86 (+616.67%)
Mutual labels:  authorization
cognito-srp
Go library for AWS Cognito SRP
Stars: ✭ 40 (+233.33%)
Mutual labels:  srp
lua-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (OpenResty)
Stars: ✭ 43 (+258.33%)
Mutual labels:  authorization
firebase-spring-boot-rest-api-authentication
Firebase Spring Boot Rest API Authentication
Stars: ✭ 172 (+1333.33%)
Mutual labels:  authorization
opa-docker-authz
A policy-enabled authorization plugin for Docker.
Stars: ✭ 67 (+458.33%)
Mutual labels:  authorization
beyondauth
a traefik / nginx companion to create an identity aware proxy like beyondcorp
Stars: ✭ 26 (+116.67%)
Mutual labels:  authorization
macaroon
Rust implementation of macaroons.
Stars: ✭ 16 (+33.33%)
Mutual labels:  authorization
hapi-doorkeeper
User authentication for web servers
Stars: ✭ 14 (+16.67%)
Mutual labels:  authorization
deflek
index and API RBAC for Elasticsearch and Kibana via reverse proxy. DEPRECATED
Stars: ✭ 13 (+8.33%)
Mutual labels:  authorization
gotrue
A JWT based API for managing users and issuing JWT tokens
Stars: ✭ 325 (+2608.33%)
Mutual labels:  authorization
react-jwt-auth
React JWT Authentication & Authorization example - React.js Login and Registration example
Stars: ✭ 307 (+2458.33%)
Mutual labels:  authorization
MovieGo
A Website implemented using MERN (MongoDB, ExpressJS, ReactJS and NodeJS) stack, which allows users to sign-in/register and book movie tickets online.
Stars: ✭ 26 (+116.67%)
Mutual labels:  authorization
auth
🔑 Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
Stars: ✭ 39 (+225%)
Mutual labels:  authorization
spring-boot-login-example
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example
Stars: ✭ 50 (+316.67%)
Mutual labels:  authorization
gothic
🦇 Gothic is a user registration and authentication SWT/JWT microservice. It supports REST, gRPC, and gRPC Web API, reCAPTCHA & a variety of DBs with Gorm.
Stars: ✭ 65 (+441.67%)
Mutual labels:  authorization
URP-Sun-Shafts
A URP port of Unity's classic Standard Assets Effects package's Sun Shaft effect
Stars: ✭ 36 (+200%)
Mutual labels:  srp
authorizer
Your data, your control. Fully open source, authentication and authorization. No lock-ins. Deployment in Railway in 120 seconds || Spin a docker image as a micro-service in your infra. Built in login page and Admin panel out of the box.
Stars: ✭ 770 (+6316.67%)
Mutual labels:  authorization

PunditKit

Maintainability Build Status

Instalation

Add pundit_kit to your gemfile:

gem 'pundit_kit'

Usage

Example of initializer routes:

class ClientNotAllowedError < StandardError; end
class UserNotAllowedError < StandardError; end

PunditKit.routes do
  namespace :staff, if: -> (user) { user.staff? }, presence: false do
    namespace :admin, if: -> (user) { user.admin? }
    namespace :user, if: -> (user) { user.user? }, error: UserNotAllowedError
  end

  namespace :client, if: -> (user) { user.client? }, error: ClientNotAllowedError do
    namespace :superclient,
              if: -> (user) { user.superclient? },
              error: ClientNotAllowedError,
              presence: false
  end
end

Each namespace has these options:

options default description
if: -> { true } lamda(or any callable object) evaluation of which determines should be used this namespace or not
presence: true if true then will raise error if policy in this namespace can't be found
error: Pundit::NotAuthorizedError error which would be raised if authorize call will return false

Example

For example yours application logic looks like this: Include PunditKit to ApplicationController

class ApplicationController <  ActionController::Base
  include PunditKit
end

This'll add helpers to yours controllers:

  • authorize_all - this method will call authorize on every namespace
  • all_policies - this method will return all namespaces matches to pundit_namespace_matcher

TODO

  • scope
  • fallbacks

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/wilddima/pundit_kit.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the PunditKit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].