<commit_before># Guardian

[![GitHub license](https://img.shields.io/github/license/timtegeler/guardian.svg)]()

**Guardian** provides a adapter between an authentication backend and your PSR-15 middleware stack

- Compatible to the PSR-15 middleware interface 
- Adaptable to your authentication backend with a simple interface

```php
<?php

// create a new authentication backend which implements the AuthenticationInterface
$authenticationBackend = new AuthenticationBackend();

// using e.g. mindplay-dk/middleman as a dispatcher for the middleware stack
$response = (new Dispatcher(
    [   
        // inject Guardian with the authentication backend instance
        new Guardian($authenticationBackend),
        // ... more middlwares e.g. a router
        new Router()
    ]
))->dispatch($request);
```

## Authentication Backend

The focus of Guardian is the adaptation of an authentication backend with a PSR-15 middleware stack. 

This means that Guardian itself is not capable of providing authentication e.g. [Basic access authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). But Guardian ships with a simple interface that can be implement by the authentication backend. The `authenticate` method receives the current request as a parameter and must return a `boolean` (which stands for `access approved` respectively `access denied`) . 
 
```php
<?php

interface AuthenticationInterface
{

    /**
     * @param ServerRequestInterface $request
     * @return bool
     */
    public function authenticate(ServerRequestInterface $request);

}
```<commit_msg>Added build shield<commit_after># Guardian

[![GitHub license](https://img.shields.io/github/license/timtegeler/guardian.svg)]()
[![Build Status](https://travis-ci.org/timtegeler/guardian.svg?branch=master)](https://travis-ci.org/timtegeler/guardian)

**Guardian** provides a adapter between an authentication backend and your PSR-15 middleware stack

- Compatible to the PSR-15 middleware interface 
- Adaptable to your authentication backend with a simple interface

```php
<?php

// create a new authentication backend which implements the AuthenticationInterface
$authenticationBackend = new AuthenticationBackend();

// using e.g. mindplay-dk/middleman as a dispatcher for the middleware stack
$response = (new Dispatcher(
    [   
        // inject Guardian with the authentication backend instance
        new Guardian($authenticationBackend),
        // ... more middlwares e.g. a router
        new Router()
    ]
))->dispatch($request);
```

## Authentication Backend

The focus of Guardian is the adaptation of an authentication backend with a PSR-15 middleware stack. 

This means that Guardian itself is not capable of providing authentication e.g. [Basic access authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). But Guardian ships with a simple interface that can be implement by the authentication backend. The `authenticate` method receives the current request as a parameter and must return a `boolean` (which stands for `access approved` respectively `access denied`) . 
 
```php
<?php

interface AuthenticationInterface
{

    /**
     * @param ServerRequestInterface $request
     * @return bool
     */
    public function authenticate(ServerRequestInterface $request);

}
```
{'fraction_non_alphanumeric': 0.08918348900271166, 'fraction_numerical': 0.0036155468514612837, 'mean_word_length': 4.220125786163522, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 6, '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': '1803829', 'n_tokens_mistral': 872, 'n_tokens_neox': 830, 'n_words': 324}