From f50c534a9bf0db1648d9a10ec6b892fc02b5e498 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 21 Jun 2016 14:23:04 +0200 Subject: [PATCH 1/3] Add authentication process description This small improvement will help users, including myself, to find out quickly what to put in the authentication section. See #367 --- Resources/doc/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Resources/doc/index.md b/Resources/doc/index.md index d080aa89..00852723 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -515,6 +515,8 @@ class YourApiController extends Controller } ``` +__Note__: Your favorite authentication process is one of the following: ```x509```, ```remote_user```, ```http_basic```, ```http_basic_ldap```, ```http_digest```, ```guard```, ```form_login```, ```form_login_ldap```. To get more information, visit the [security configuration reference page](http://symfony.com/doc/current/reference/configuration/security.html). + ### Step 5: Configure FOSOAuthServerBundle Import the routing.yml configuration file in app/config/routing.yml: From 2c09afd89942e62442afadfa964d1c71991ee4c6 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 19 Jul 2016 15:50:50 +0200 Subject: [PATCH 2/3] Add authentication process example Add an simple example using http_basic. --- Resources/doc/index.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 00852723..5dd9fab6 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -517,6 +517,38 @@ class YourApiController extends Controller __Note__: Your favorite authentication process is one of the following: ```x509```, ```remote_user```, ```http_basic```, ```http_basic_ldap```, ```http_digest```, ```guard```, ```form_login```, ```form_login_ldap```. To get more information, visit the [security configuration reference page](http://symfony.com/doc/current/reference/configuration/security.html). +__Example__: With ```http_basic``` + +```yaml +# app/config/security.yml +security: + providers: + in_memory: + memory: + users: + admin: { password: admin } + + firewalls: + oauth_token: + pattern: ^/oauth/v2/token + security: false + + oauth_authorize: + pattern: ^/oauth/v2/auth + http_basic: + provider: in_memory + + api: + pattern: ^/api + fos_oauth: true + stateless: true + anonymous: false # can be omitted as its default value + + access_control: + - { path: ^/api, roles: [ IS_AUTHENTICATED_FULLY ] } + +``` + ### Step 5: Configure FOSOAuthServerBundle Import the routing.yml configuration file in app/config/routing.yml: From 3eed29591e81011781bb3d87db41cab997d53f7a Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 19 Jul 2016 15:53:07 +0200 Subject: [PATCH 3/3] remove tabs --- Resources/doc/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 5dd9fab6..b3273278 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -536,7 +536,7 @@ security: oauth_authorize: pattern: ^/oauth/v2/auth http_basic: - provider: in_memory + provider: in_memory api: pattern: ^/api