Skip to content

Commit

Permalink
Merge pull request #379 from j0k3r/sf3-doc
Browse files Browse the repository at this point in the history
Update form in doc
  • Loading branch information
GuilhemN committed Jan 14, 2016
2 parents a67c26e + 9dab0aa commit 61f20a2
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 74 deletions.
99 changes: 50 additions & 49 deletions Resources/doc/configuration_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,55 @@ FOSOAuthServerBundle Configuration Reference

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

fos_oauth_server:
db_driver: ~ # Required. Available: mongodb, orm, propel
client_class: ~ # Required
access_token_class: ~ # Required
refresh_token_class: ~ # Required
auth_code_class: ~ # Required
model_manager_name: ~ # change it to the name of your entity/document manager if you don't want to use the default one.
authorize:
form:
type: fos_oauth_server_authorize
handler: fos_oauth_server.authorize.form.handler.default
name: fos_oauth_server_authorize_form
validation_groups:

# Defaults:
- Authorize
- Default
service:
storage: fos_oauth_server.storage.default
user_provider: ~
client_manager: fos_oauth_server.client_manager.default
access_token_manager: fos_oauth_server.access_token_manager.default
refresh_token_manager: fos_oauth_server.refresh_token_manager.default
auth_code_manager: fos_oauth_server.auth_code_manager.default
options:
# Prototype
key: []

# Example
# supported_scopes: string

# Changing tokens and authcode lifetime
#access_token_lifetime: 3600
#refresh_token_lifetime: 1209600
#auth_code_lifetime: 30
# Token type to respond with. Currently only "Bearer" supported.
#token_type: string

#realm:

# Enforce redirect_uri on input for both authorize and token steps.
#enforce_redirect: true or false

# Enforce state to be passed in authorization (see RFC 6749, section 10.12)
#enforce_state: true or false
template:
engine: twig

``` yaml
fos_oauth_server:
db_driver: ~ # Required. Available: mongodb, orm, propel
client_class: ~ # Required
access_token_class: ~ # Required
refresh_token_class: ~ # Required
auth_code_class: ~ # Required
model_manager_name: ~ # change it to the name of your entity/document manager if you don't want to use the default one.
authorize:
form:
type: fos_oauth_server_authorize
handler: fos_oauth_server.authorize.form.handler.default
name: fos_oauth_server_authorize_form
validation_groups:

# Defaults:
- Authorize
- Default
service:
storage: fos_oauth_server.storage.default
user_provider: ~
client_manager: fos_oauth_server.client_manager.default
access_token_manager: fos_oauth_server.access_token_manager.default
refresh_token_manager: fos_oauth_server.refresh_token_manager.default
auth_code_manager: fos_oauth_server.auth_code_manager.default
options:
# Prototype
key: []

# Example
# supported_scopes: string

# Changing tokens and authcode lifetime
#access_token_lifetime: 3600
#refresh_token_lifetime: 1209600
#auth_code_lifetime: 30

# Token type to respond with. Currently only "Bearer" supported.
#token_type: string

#realm:

# Enforce redirect_uri on input for both authorize and token steps.
#enforce_redirect: true or false

# Enforce state to be passed in authorization (see RFC 6749, section 10.12)
#enforce_state: true or false
template:
engine: twig
```
[Back to index](index.md)
2 changes: 1 addition & 1 deletion Resources/doc/extending_the_authorization_page.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ you will see a `client` variable which is passed to the templating engine. That
``` html+jinja
<h2>The application "{{ client.name }}" would like to connect to your account</h2>
<form action="{{ path('fos_oauth_server_authorize') }}" method="POST" class="fos_oauth_server_authorize" {{ form_enctype(form) }}>
{{ form_start(form, {'method': 'POST', 'action': path('fos_oauth_server_authorize'), 'label_attr': {'class': 'fos_oauth_server_authorize'} }) }}
<input class="btn" type="submit" name="rejected" value="{{ 'authorize.reject'|trans({}, 'FOSOAuthServerBundle') }}" />
<input class="btn btn-primary" type="submit" name="accepted" value="{{ 'authorize.accept'|trans({}, 'FOSOAuthServerBundle') }}" />
Expand Down
43 changes: 19 additions & 24 deletions Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class AuthCode extends BaseAuthCode
}
```

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

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

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

``` js
``` json
{
"require": {
"willdurand/propel-typehintable-behavior": "*"
Expand Down Expand Up @@ -285,10 +285,9 @@ namespace Acme\ApiBundle\Document;

use FOS\OAuthServerBundle\Document\Client as BaseClient;

class Client extends BaseClient
class Client extends BaseClient
{
protected $id;

}
```

Expand All @@ -303,9 +302,9 @@ class Client extends BaseClient
<document name="Acme\ApiBundle\Document\Client" db="acme" collection="oauthClient" customId="true">
<field fieldName="id" id="true" strategy="AUTO" />
</document>

</doctrine-mongo-mapping>
```
```

``` php
<?php
Expand All @@ -317,11 +316,11 @@ namespace Acme\ApiBundle\Document;
use FOS\OAuthServerBundle\Document\AuthCode as BaseAuthCode;
use FOS\OAuthServerBundle\Model\ClientInterface;

class AuthCode extends BaseAuthCode
class AuthCode extends BaseAuthCode
{
protected $id;
protected $client;

public function getClient()
{
return $this->client;
Expand All @@ -331,9 +330,7 @@ class AuthCode extends BaseAuthCode
{
$this->client = $client;
}

}

```

``` xml
Expand All @@ -348,9 +345,9 @@ class AuthCode extends BaseAuthCode
<field fieldName="id" id="true" strategy="AUTO" />
<reference-one target-document="Acme\ApiBundle\Document\Client" field="client" />
</document>

</doctrine-mongo-mapping>
```
```

``` php
<?php
Expand All @@ -362,11 +359,11 @@ namespace Acme\ApiBundle\Document;
use FOS\OAuthServerBundle\Document\AccessToken as BaseAccessToken;
use FOS\OAuthServerBundle\Model\ClientInterface;

class AccessToken extends BaseAccessToken
class AccessToken extends BaseAccessToken
{
protected $id;
protected $client;

public function getClient()
{
return $this->client;
Expand All @@ -376,7 +373,6 @@ class AccessToken extends BaseAccessToken
{
$this->client = $client;
}

}
```

Expand All @@ -392,9 +388,9 @@ class AccessToken extends BaseAccessToken
<field fieldName="id" id="true" strategy="AUTO" />
<reference-one target-document="Acme\ApiBundle\Document\Client" field="client" />
</document>

</doctrine-mongo-mapping>
```
```

``` php
<?php
Expand All @@ -406,11 +402,11 @@ namespace Acme\ApiBundle\Document;
use FOS\OAuthServerBundle\Document\RefreshToken as BaseRefreshToken;
use FOS\OAuthServerBundle\Model\ClientInterface;

class RefreshToken extends BaseRefreshToken
class RefreshToken extends BaseRefreshToken
{
protected $id;
protected $client;

public function getClient()
{
return $this->client;
Expand All @@ -420,7 +416,6 @@ class RefreshToken extends BaseRefreshToken
{
$this->client = $client;
}

}
```

Expand All @@ -436,9 +431,9 @@ class RefreshToken extends BaseRefreshToken
<field fieldName="id" id="true" strategy="AUTO" />
<reference-one target-document="Acme\ApiBundle\Document\Client" field="client" />
</document>

</doctrine-mongo-mapping>
```
```

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

Expand Down Expand Up @@ -581,8 +576,8 @@ $client->setAllowedGrantTypes(array('token', 'authorization_code'));
$clientManager->updateClient($client);
```

Once you have created a client, you need to pass its `publicId` to the authorize endpoint. You also need
to specify a redirect uri as well as a response type.
Once you have created a client, you need to pass its `publicId` to the authorize endpoint. You also need
to specify a redirect uri as well as a response type.

```php
return $this->redirect($this->generateUrl('fos_oauth_server_authorize', array(
Expand Down

0 comments on commit 61f20a2

Please sign in to comment.