francodacosta / caparica-bundle
a symfony bundle to help secure your REST api with signed requests
Installs: 2 236
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- francodacosta/caparica: ~1.0
Requires (Dev)
- mockery/mockery: dev-master@dev
README
Getting started with Caparica Bundle
Instalation
1. Download CaparicaBundle using composer
2. Enable the Bundle
3. add a client
4. Configure your controller
Step1: Download CaparicaBundle using composer
Add CaparicaBundle by running the command:
$ php composer.phar require francodacosta/caparica-bundle '~1.0'
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Francodacosta\CaparicaBundle\FrancodacostaCaparicaBundle(), ); }
Step 3: Configure a client
So that the server can verify the client signature it needs to know the client/api id and secret
If using the YamlClientProvider
edit the file : app/config/caparica.yml
client_alias: code: "the client code" secret: "the client api secret"
add the following to your app/config.yml
file
francodacosta_caparica: client_provider_id: francodacosta.caparica.client.provider.yaml
Step 4: Configure your controller
Make sure you controller implements the Francodacosta\CaparicaBundle\Controller\CaparicaControllerInterface
.
The Francodacosta\CaparicaBundle\Controller\CaparicaController
extends the Symfony controller and has some handy methods.
and that's it all controller actions accessed via a route will have to be signed