Skip to content

Commit 61f20a2

Browse files
committed
Merge pull request #379 from j0k3r/sf3-doc
Update form in doc
2 parents a67c26e + 9dab0aa commit 61f20a2

File tree

3 files changed

+70
-74
lines changed

3 files changed

+70
-74
lines changed

Resources/doc/configuration_reference.md

+50-49
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,55 @@ FOSOAuthServerBundle Configuration Reference
33

44
All available configuration options are listed below with their default values.
55

6-
fos_oauth_server:
7-
db_driver: ~ # Required. Available: mongodb, orm, propel
8-
client_class: ~ # Required
9-
access_token_class: ~ # Required
10-
refresh_token_class: ~ # Required
11-
auth_code_class: ~ # Required
12-
model_manager_name: ~ # change it to the name of your entity/document manager if you don't want to use the default one.
13-
authorize:
14-
form:
15-
type: fos_oauth_server_authorize
16-
handler: fos_oauth_server.authorize.form.handler.default
17-
name: fos_oauth_server_authorize_form
18-
validation_groups:
19-
20-
# Defaults:
21-
- Authorize
22-
- Default
23-
service:
24-
storage: fos_oauth_server.storage.default
25-
user_provider: ~
26-
client_manager: fos_oauth_server.client_manager.default
27-
access_token_manager: fos_oauth_server.access_token_manager.default
28-
refresh_token_manager: fos_oauth_server.refresh_token_manager.default
29-
auth_code_manager: fos_oauth_server.auth_code_manager.default
30-
options:
31-
# Prototype
32-
key: []
33-
34-
# Example
35-
# supported_scopes: string
36-
37-
# Changing tokens and authcode lifetime
38-
#access_token_lifetime: 3600
39-
#refresh_token_lifetime: 1209600
40-
#auth_code_lifetime: 30
41-
42-
# Token type to respond with. Currently only "Bearer" supported.
43-
#token_type: string
44-
45-
#realm:
46-
47-
# Enforce redirect_uri on input for both authorize and token steps.
48-
#enforce_redirect: true or false
49-
50-
# Enforce state to be passed in authorization (see RFC 6749, section 10.12)
51-
#enforce_state: true or false
52-
template:
53-
engine: twig
54-
6+
``` yaml
7+
fos_oauth_server:
8+
db_driver: ~ # Required. Available: mongodb, orm, propel
9+
client_class: ~ # Required
10+
access_token_class: ~ # Required
11+
refresh_token_class: ~ # Required
12+
auth_code_class: ~ # Required
13+
model_manager_name: ~ # change it to the name of your entity/document manager if you don't want to use the default one.
14+
authorize:
15+
form:
16+
type: fos_oauth_server_authorize
17+
handler: fos_oauth_server.authorize.form.handler.default
18+
name: fos_oauth_server_authorize_form
19+
validation_groups:
20+
21+
# Defaults:
22+
- Authorize
23+
- Default
24+
service:
25+
storage: fos_oauth_server.storage.default
26+
user_provider: ~
27+
client_manager: fos_oauth_server.client_manager.default
28+
access_token_manager: fos_oauth_server.access_token_manager.default
29+
refresh_token_manager: fos_oauth_server.refresh_token_manager.default
30+
auth_code_manager: fos_oauth_server.auth_code_manager.default
31+
options:
32+
# Prototype
33+
key: []
34+
35+
# Example
36+
# supported_scopes: string
37+
38+
# Changing tokens and authcode lifetime
39+
#access_token_lifetime: 3600
40+
#refresh_token_lifetime: 1209600
41+
#auth_code_lifetime: 30
42+
43+
# Token type to respond with. Currently only "Bearer" supported.
44+
#token_type: string
45+
46+
#realm:
47+
48+
# Enforce redirect_uri on input for both authorize and token steps.
49+
#enforce_redirect: true or false
50+
51+
# Enforce state to be passed in authorization (see RFC 6749, section 10.12)
52+
#enforce_state: true or false
53+
template:
54+
engine: twig
55+
```
5556
5657
[Back to index](index.md)

Resources/doc/extending_the_authorization_page.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ you will see a `client` variable which is passed to the templating engine. That
1919
``` html+jinja
2020
<h2>The application "{{ client.name }}" would like to connect to your account</h2>
2121
22-
<form action="{{ path('fos_oauth_server_authorize') }}" method="POST" class="fos_oauth_server_authorize" {{ form_enctype(form) }}>
22+
{{ form_start(form, {'method': 'POST', 'action': path('fos_oauth_server_authorize'), 'label_attr': {'class': 'fos_oauth_server_authorize'} }) }}
2323
<input class="btn" type="submit" name="rejected" value="{{ 'authorize.reject'|trans({}, 'FOSOAuthServerBundle') }}" />
2424
<input class="btn btn-primary" type="submit" name="accepted" value="{{ 'authorize.accept'|trans({}, 'FOSOAuthServerBundle') }}" />
2525

Resources/doc/index.md

+19-24
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class AuthCode extends BaseAuthCode
231231
}
232232
```
233233

234-
__Note__: If you don't have `auto_mapping` activated in your doctrine configuration you need to add
234+
__Note__: If you don't have `auto_mapping` activated in your doctrine configuration you need to add
235235
`FOSOAuthServerBundle` to your mappings in `config.yml`.
236236

237237
#### Propel
@@ -241,7 +241,7 @@ You have to install the [TypehintableBehavior](https://github.com/willdurand/Typ
241241

242242
By using [Composer](http://getcomposer.org), you just have to add the following line in your `composer.json`:
243243

244-
``` js
244+
``` json
245245
{
246246
"require": {
247247
"willdurand/propel-typehintable-behavior": "*"
@@ -285,10 +285,9 @@ namespace Acme\ApiBundle\Document;
285285

286286
use FOS\OAuthServerBundle\Document\Client as BaseClient;
287287

288-
class Client extends BaseClient
288+
class Client extends BaseClient
289289
{
290290
protected $id;
291-
292291
}
293292
```
294293

@@ -303,9 +302,9 @@ class Client extends BaseClient
303302
<document name="Acme\ApiBundle\Document\Client" db="acme" collection="oauthClient" customId="true">
304303
<field fieldName="id" id="true" strategy="AUTO" />
305304
</document>
306-
305+
307306
</doctrine-mongo-mapping>
308-
```
307+
```
309308

310309
``` php
311310
<?php
@@ -317,11 +316,11 @@ namespace Acme\ApiBundle\Document;
317316
use FOS\OAuthServerBundle\Document\AuthCode as BaseAuthCode;
318317
use FOS\OAuthServerBundle\Model\ClientInterface;
319318

320-
class AuthCode extends BaseAuthCode
319+
class AuthCode extends BaseAuthCode
321320
{
322321
protected $id;
323322
protected $client;
324-
323+
325324
public function getClient()
326325
{
327326
return $this->client;
@@ -331,9 +330,7 @@ class AuthCode extends BaseAuthCode
331330
{
332331
$this->client = $client;
333332
}
334-
335333
}
336-
337334
```
338335

339336
``` xml
@@ -348,9 +345,9 @@ class AuthCode extends BaseAuthCode
348345
<field fieldName="id" id="true" strategy="AUTO" />
349346
<reference-one target-document="Acme\ApiBundle\Document\Client" field="client" />
350347
</document>
351-
348+
352349
</doctrine-mongo-mapping>
353-
```
350+
```
354351

355352
``` php
356353
<?php
@@ -362,11 +359,11 @@ namespace Acme\ApiBundle\Document;
362359
use FOS\OAuthServerBundle\Document\AccessToken as BaseAccessToken;
363360
use FOS\OAuthServerBundle\Model\ClientInterface;
364361

365-
class AccessToken extends BaseAccessToken
362+
class AccessToken extends BaseAccessToken
366363
{
367364
protected $id;
368365
protected $client;
369-
366+
370367
public function getClient()
371368
{
372369
return $this->client;
@@ -376,7 +373,6 @@ class AccessToken extends BaseAccessToken
376373
{
377374
$this->client = $client;
378375
}
379-
380376
}
381377
```
382378

@@ -392,9 +388,9 @@ class AccessToken extends BaseAccessToken
392388
<field fieldName="id" id="true" strategy="AUTO" />
393389
<reference-one target-document="Acme\ApiBundle\Document\Client" field="client" />
394390
</document>
395-
391+
396392
</doctrine-mongo-mapping>
397-
```
393+
```
398394

399395
``` php
400396
<?php
@@ -406,11 +402,11 @@ namespace Acme\ApiBundle\Document;
406402
use FOS\OAuthServerBundle\Document\RefreshToken as BaseRefreshToken;
407403
use FOS\OAuthServerBundle\Model\ClientInterface;
408404

409-
class RefreshToken extends BaseRefreshToken
405+
class RefreshToken extends BaseRefreshToken
410406
{
411407
protected $id;
412408
protected $client;
413-
409+
414410
public function getClient()
415411
{
416412
return $this->client;
@@ -420,7 +416,6 @@ class RefreshToken extends BaseRefreshToken
420416
{
421417
$this->client = $client;
422418
}
423-
424419
}
425420
```
426421

@@ -436,9 +431,9 @@ class RefreshToken extends BaseRefreshToken
436431
<field fieldName="id" id="true" strategy="AUTO" />
437432
<reference-one target-document="Acme\ApiBundle\Document\Client" field="client" />
438433
</document>
439-
434+
440435
</doctrine-mongo-mapping>
441-
```
436+
```
442437

443438
### Step 4: Configure your application's security.yml
444439

@@ -581,8 +576,8 @@ $client->setAllowedGrantTypes(array('token', 'authorization_code'));
581576
$clientManager->updateClient($client);
582577
```
583578

584-
Once you have created a client, you need to pass its `publicId` to the authorize endpoint. You also need
585-
to specify a redirect uri as well as a response type.
579+
Once you have created a client, you need to pass its `publicId` to the authorize endpoint. You also need
580+
to specify a redirect uri as well as a response type.
586581

587582
```php
588583
return $this->redirect($this->generateUrl('fos_oauth_server_authorize', array(

0 commit comments

Comments
 (0)