Download the PHP package buildsecurity/symfony-opa without Composer

On this page you can find all versions of the php package buildsecurity/symfony-opa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-opa

opa-symfony-middleware

Abstract

build.security provides simple development and management for your organization's authorization policy. opa-symfony-middleware is a PHP Symfony middleware intended for performing authorization requests against build.security PDP(Policy Decision Point)/OPA.

This package is built for PHP v8.0 and above and Symfony v4.22 and above.

Data Flow

Usage

Before you start we recommend completing the onboarding tutorial.


Important note

To simplify the setup process, the following example uses a local build.security PDP instance. If you are already familiar with how to run your PDP, You can also run a PDP on you environment (Dev/Prod, etc).

In that case, don't forget to change the hostname and the port in your code.


Simple usage

In your Symfony app directory:

Edit your PDP configuration file (services.yaml) - This will define how requests should be made to the PDP

Register the OpenPolicyAgent service in your services.yaml

Mandatory configuration

  1. hostname: The hostname of the Policy Decision Point (PDP)
  2. port: The port at which the OPA service is running
  3. policyPath: Full path to the policy (including the rule) that decides whether requests should be authorized

The PDP_HOSTNAME, PDP_PORT, PDP_POLICY_PATH, PDP_READ_TIMEOUT_MS, PDP_CONNECTION_TIMEOUT_MS, PDP_RETRY_MAX_ATTEMPTS and PDP_RETRY_BACKOFF_MS environment variables, when added to your Symfony server environment, will override this service configuration.

Optional configuration

  1. allowOnFailure: Boolean. "Fail open" mechanism to allow access to the API in case the policy engine is not reachable. Default is false.
  2. includeBody: Boolean. Whether or not to pass the request body to the policy engine. Default is true.
  3. includeHeaders: Boolean. Whether or not to pass the request headers to the policy engine. Default is true
  4. timeout: Boolean. Amount of time to wait before request is abandoned and request is declared as failed. Default is 1000ms.
  5. enable: Boolean. Whether or not to consult with the policy engine for the specific request. Default is true
Example

To add the authorization middleware to a controller method, just decorate it with the Authorize attribute.

For more elaborated example click here

PDP Request example

This is what the input received by the PDP would look like.

If everything works well you should receive the following response: +


All versions of symfony-opa with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-ctype Version *
ext-iconv Version *
symfony/console Version 5.2.*
symfony/dotenv Version 5.2.*
symfony/flex Version ^1.3.1
symfony/framework-bundle Version 5.2.*
symfony/http-client Version 5.2.*
symfony/yaml Version 5.2.*
busybee/urljoin Version dev-main
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package buildsecurity/symfony-opa contains the following files

Loading the files please wait ....