<commit_before># KnpOAuthBundle

## Custom OAuth Providers

You can of course implement your own custom OAuth provider. The good news is it's a fairly easy three steps process:

1. Implement the `Knp\Bundle\OAuthBundle\Security\Http\OAuth\OAuthProviderInterface` interface
2. Declare the corresponding service
3. Configure your firewall

### Implementing the interface

The interface is not too hard to implement, it only consists in three methods:

* `getUsername($accessToken)` must return the user's username.
* `getAuthorizationUrl($loginCheckUrl, array $extraParameters = array())` must return the provider's authorization url.
* `getAccessToken($code, array $extraParameters = array())` must return an access token.

Please see `Knp\Bundle\OAuthBundle\Security\Http\OAuth\OAuthProvider` for an example implementation.

To ease the task even a little more, you can extend the generic `OAuthProvider` provider. This provider comes with a few helper methods:

* `configure()` is the place to put some custom logic (you can see the `GithubProvider` for an example of that).
* `getOption($name)` retrieves an option, with existance check.
* `httpRequest($url, $method)` is a small wrapper around `Buzz`.

### Declaring the DIC service

Once your provider is implemented, you need to declare it as a DIC service. This step is fairly easy too, since Symfony provides a way to declare services without the hassle of creating a DIC Extension. Just define your service in your configuration, under the `services` section:
<commit_msg>removed reference about DIC Extensions since it's not needed<commit_after># KnpOAuthBundle

## Custom OAuth Providers

You can of course implement your own custom OAuth provider. The good news is it's a fairly easy three steps process:

1. Implement the `Knp\Bundle\OAuthBundle\Security\Http\OAuth\OAuthProviderInterface` interface
2. Declare the corresponding service
3. Configure your firewall

### Implementing the interface

The interface is not too hard to implement, it only consists in three methods:

* `getUsername($accessToken)` must return the user's username.
* `getAuthorizationUrl($loginCheckUrl, array $extraParameters = array())` must return the provider's authorization url.
* `getAccessToken($code, array $extraParameters = array())` must return an access token.

Please see `Knp\Bundle\OAuthBundle\Security\Http\OAuth\OAuthProvider` for an example implementation.

To ease the task even a little more, you can extend the generic `OAuthProvider` provider. This provider comes with a few helper methods:

* `configure()` is the place to put some custom logic (you can see the `GithubProvider` for an example of that).
* `getOption($name)` retrieves an option, with existance check.
* `httpRequest($url, $method)` is a small wrapper around `Buzz`.

### Declaring the DIC service

Once your provider is implemented, you need to declare it as a DIC service. This step is fairly easy too, you just have to define your service in your configuration, under the `services` section:

{'fraction_non_alphanumeric': 0.07412309728656519, 'fraction_numerical': 0.001985440105890139, 'mean_word_length': 5.2329896907216495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2754425', 'n_tokens_mistral': 786, 'n_tokens_neox': 778, 'n_words': 389}