All Projects → urbint → bastion

urbint / bastion

Licence: other
No description or website provided.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to bastion

Voice Overlay Android
🗣 An overlay that gets your user’s voice permission and input as text in a customizable UI
Stars: ✭ 189 (+1618.18%)
Mutual labels:  permissions
Spring Boot Start Current
Spring Boot 脚手架 Mybatis Spring Security JWT 权限 Spring Cache + Redis
Stars: ✭ 246 (+2136.36%)
Mutual labels:  permissions
spicedb
Open Source, Google Zanzibar-inspired fine-grained permissions database
Stars: ✭ 3,358 (+30427.27%)
Mutual labels:  permissions
Easypermission
一个非常轻便而且可用的Android动态权限申请库
Stars: ✭ 192 (+1645.45%)
Mutual labels:  permissions
Vue Router User Roles
A Vue.js plugin that protects routes based on user roles. Add your own authentication.
Stars: ✭ 237 (+2054.55%)
Mutual labels:  permissions
Kpermissions
A Kotlin library which helps to request runtime permissions in Android.
Stars: ✭ 253 (+2200%)
Mutual labels:  permissions
Keycloak Nodejs Example
A simply step by step Keycloak, MySQL and Node.js integration tutorial. There are some docker examples as well.
Stars: ✭ 183 (+1563.64%)
Mutual labels:  permissions
absinthe error payload
Bridges the gap between Ecto and Absinthe for mutation payload
Stars: ✭ 102 (+827.27%)
Mutual labels:  absinthe
Bouncer
Eloquent roles and abilities.
Stars: ✭ 2,763 (+25018.18%)
Mutual labels:  permissions
ada-security
Ada Security - OAuth 2.0 client and server framework to secure web applications
Stars: ✭ 18 (+63.64%)
Mutual labels:  permissions
Adonis Acl
demo app: https://github.com/enniel/adonis-acl-blog-demo
Stars: ✭ 195 (+1672.73%)
Mutual labels:  permissions
Appy
🚀 A full stack boilerplate web app
Stars: ✭ 225 (+1945.45%)
Mutual labels:  permissions
Rbac
Hierarchical Role-Based Access Control for Node.js
Stars: ✭ 254 (+2209.09%)
Mutual labels:  permissions
Sanic Jwt
Authentication, JWT, and permission scoping for Sanic
Stars: ✭ 189 (+1618.18%)
Mutual labels:  permissions
graphql authorize
Authorization helpers for ruby-graphql fields
Stars: ✭ 23 (+109.09%)
Mutual labels:  permissions
Vue Gates
🔒 A Vue.js & Nuxt.js plugin that allows you to use roles and permissions in your components or DOM elements, also compatible as middleware and methods.
Stars: ✭ 184 (+1572.73%)
Mutual labels:  permissions
Graphql Shield
🛡 A GraphQL tool to ease the creation of permission layer.
Stars: ✭ 3,121 (+28272.73%)
Mutual labels:  permissions
rbac
Simple RBAC/ACL for Laravel 8 caching and permission groups.
Stars: ✭ 43 (+290.91%)
Mutual labels:  permissions
advancedPermissionHandler
This Android library is for handle running time permissions in simplest way!
Stars: ✭ 13 (+18.18%)
Mutual labels:  permissions
async-permissions
Easy handling for Android-M permission based on async/await
Stars: ✭ 25 (+127.27%)
Mutual labels:  permissions

Bastion

Hex pm

Installation

Bastion can be installed by adding bastion to your list of dependencies in mix.exs:

def deps do
  [
    {:bastion, "~> 0.1.0"},
  ]
end

Overview (from Bastion main @moduledoc)

Bastion allows you to specify scopes in your Absinthe GraphQL Schemas, and then authorize requests only on requested fields.

To use Bastion, you need to:

  1. Set scopes on your GraphQL fields via Bastion's scopes macro
  2. Set the authorized scopes on each Plug.Conn.t, via Bastion.Plug.set_authorized_scopes/2
  3. Call plug Bastion.Plug ahead of plug Absinthe.Plug in your router

Bastion will reject requests to scoped fields that the user does not have an authorized scope for.

Notably, the request is rejected only if a scoped field is included - requests for non protected fields will pass through.

Example Usage

In your Absinthe.Schema:

defmodule MyAbsintheSchema do
  use Absinthe.Schema
  use Bastion

  query do
    field :users, list_of(:user) do
      scopes [:admin]
    end
  end

  object :user do
    field :name, :string
  end
end

In your router:

defmodule MyRouter do
  use Plug

  plug :set_scopes

  defp set_scopes(conn, _opts) do
    # get authorized scopes from your own user or domain logic
    Bastion.Plug.set_authorized_scopes(conn, [:admin])
  end

  plug Bastion.Plug, schema: MyAbsintheSchema
  plug Absinthe.Plug, schema: MyAbsintheSchema
end

Rejecting all requests

This is effectively an authorization middleware, and so its opinion leans toward rejecting requests more quickly than not.

If you do not set the authorized scopes on the connection with a call to Bastion.Plug.set_authorized_scopes/2 BEFORE calling plug Bastion.Plug in your router, ALL of the requests will be rejected.

If you're getting started with Bastion, you can write a simple plug function to set the authorized scopes to an empty list, as exemplified in the readme.

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].