All Projects → Bisnode → opa-spring-security

Bisnode / opa-spring-security

Licence: Apache-2.0 License
Open Policy Agent for Spring Security

Programming Languages

java
68154 projects - #9 most used programming language
groovy
2714 projects
kotlin
9241 projects

Projects that are alternatives of or similar to opa-spring-security

opa-kafka-plugin
Open Policy Agent (OPA) plug-in for Kafka authorization
Stars: ✭ 46 (+142.11%)
Mutual labels:  authorization, opa, openpolicyagent
Sureness
A simple and efficient open-source security framework that focus on protection of restful api.
Stars: ✭ 254 (+1236.84%)
Mutual labels:  authorization, spring-security
Spring Security Pac4j
pac4j security library for Spring Security: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 231 (+1115.79%)
Mutual labels:  authorization, spring-security
opa-java-client
No description or website provided.
Stars: ✭ 25 (+31.58%)
Mutual labels:  opa, openpolicyagent
Registration Login Spring Xml Maven Jsp Mysql
Registration and Login Example with Spring MVC, Spring Security, Spring Data JPA, XML Configuration, Maven, JSP, and MySQL.
Stars: ✭ 134 (+605.26%)
Mutual labels:  authorization, spring-security
Pac4j
Security engine for Java (authentication, authorization, multi frameworks): OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 2,097 (+10936.84%)
Mutual labels:  authorization, spring-security
spring-boot-jwt-auth
🔑 Sample Spring boot application secured using JWT auth in custom header(X-Auth-Token).
Stars: ✭ 57 (+200%)
Mutual labels:  authorization, spring-security
Opa
An open source, general-purpose policy engine.
Stars: ✭ 5,939 (+31157.89%)
Mutual labels:  authorization, opa
spring-boot-login-example
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example
Stars: ✭ 50 (+163.16%)
Mutual labels:  authorization, spring-security
opa-docker-authz
A policy-enabled authorization plugin for Docker.
Stars: ✭ 67 (+252.63%)
Mutual labels:  authorization, opa
pre-commit-opa
Pre-commit git hooks for Open Policy Agent (OPA) and Rego development
Stars: ✭ 53 (+178.95%)
Mutual labels:  opa, openpolicyagent
Sample Spring Oauth2 Microservices
some examples that show basic and more advanced implementations of oauth2 authorization mechanism in spring-cloud microservices environment
Stars: ✭ 109 (+473.68%)
Mutual labels:  authorization, spring-security
Spring Security React Ant Design Polls App
Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
Stars: ✭ 1,336 (+6931.58%)
Mutual labels:  authorization, spring-security
Registration Login Spring Hsql
Registration and Login Example with Spring Security, Spring Boot, Spring Data JPA, HSQL, JSP
Stars: ✭ 208 (+994.74%)
Mutual labels:  authorization, spring-security
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (+273.68%)
Mutual labels:  authorization, spring-security
secure-oauth2-oidc-workshop
Hands-On Workshop for OAuth 2.0 and OpenID Connect 1.0
Stars: ✭ 58 (+205.26%)
Mutual labels:  authorization, spring-security
opal
Policy and data administration, distribution, and real-time updates on top of Open Policy Agent
Stars: ✭ 459 (+2315.79%)
Mutual labels:  authorization, opa
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+2436.84%)
Mutual labels:  authorization, spring-security
firebase-spring-boot-rest-api-authentication
Firebase Spring Boot Rest API Authentication
Stars: ✭ 172 (+805.26%)
Mutual labels:  authorization, spring-security
opa-java-spring-client
Simple Spring client for working with the Open Policy Agent
Stars: ✭ 19 (+0%)
Mutual labels:  authorization, opa

OPA Spring Security Library

Maven Central build

OPA Spring Security is a library that enables using OPA for authorization in Spring applications.

Installation

Prerequisites

  • Java 11 or higher

Using the starter

Add dependency using Maven

Maven Central

<dependency>
    <groupId>com.bisnode.opa</groupId>
    <artifactId>opa-filter-spring-boot-starter</artifactId>
    <version>{version}</version>
</dependency>

or Gradle

implementation 'com.bisnode.opa:opa-filter-spring-boot-starter:{version}'

Configuration

All properties are prefixed with opa.filter

Property Default value Description Example
enabled true Whether the filter should be enabled
documentPath Name of OPA document path to use for queries "http/request/authz"
instance http://localhost:8181 Address of OPA instance
endpointsWhitelist Comma-separated list of ant patterns to use for matching whitelisted endpoints /ping,/info,/api-docs/**

Policy requirements

Currently, the filter sends following information to OPA:

  • path - path of the resource, that's being requested, e.g. /messages/2
  • method - HTTP method, e.g. GET
  • encodedJwt - encoded token from authorization (if found, null otherwise)

Those properties are available in your policy's input.


Your OPA policy response should contain following properties:

  • allow - with value true if to requested resource should be allowed. false otherwise
  • reason - an optional string containing reason behind given accessDecision, it will be supplied to exception message

Unknown properties are ignored.

Example OPA response would look as follows:

{
  "result": 
  {
      "allow": false,
      "reason": "You shall not pass"
  }
}

Published events

When library denies access to the resource, AuthorizationFailureEvent is published and therefore can be used in user's code.

Developing and building

Build process and dependency management is done using Gradle. Tests are written in Spock.

Contribution

Interested in contributing? Please, start by reading this document.

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