2017 © Pedro Peláez
 

library security-api

Helthe API Security Component

image

helthe/security-api

Helthe API Security Component

  • Friday, February 21, 2014
  • by carlalexander
  • Repository
  • 1 Watchers
  • 0 Stars
  • 46 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Helthe API Security Build Status Scrutinizer Quality Score

Helthe API Security is a library for doing API key authentication with the Symfony Security Component., (*1)

Installation

Using Composer

Manually

Add the following in your composer.json:, (*2)

{
    "require": {
        // ...
        "helthe/security-api": "~1.0"
    }
}

Using the command line

$ composer require 'helthe/security-api=~1.0'

Usage

Authentication Provider

An API authentication provider implementing AuthenticationProviderInterfaceis supplied supporting the PreAuthenticatedToken. Once authenticated, a user will be authenticated using a ApiKeyAuthenticatedToken which is an extension of PreAuthenticatedToken where the api key is not erased., (*3)

User Provider

The library provides its own UserProviderInterface that must implemented by the user provider supplied to the ApiKeyAuthenticationProvider., (*4)

Example

use Helthe\Component\Security\Api\Authentication\Provider\ApiKeyAuthenticationProvider;
use Symfony\Component\Security\Core\User\UserChecker;

// Helthe\Component\Security\Api\User\UserProviderInterface
$userProvider = new InMemoryUserProvider(
    array(
        'admin' => array(
            'api_key' => 'foo',
        ),
    )
);

// for some extra checks: is account enabled, locked, expired, etc.?
$userChecker = new UserChecker();

$provider = new ApiKeyAuthenticationProvider(
    $userProvider,
    $userChecker,
    'your_api',
);

$provider->authenticate($unauthenticatedToken);

Firewall

Two firewall listeners are available extending AbstractPreAuthenticatedListener. HttpHeaderListener checks for the api key in the Request headers and QueryStringListener checks in the Request query string., (*5)

Bugs

For bugs or feature requests, please create an issue., (*6)

The Versions

21/02 2014

dev-master

9999999-dev https://helthe.co

Helthe API Security Component

  Sources   Download

MIT

The Requires

 

by Carl Alexander

api authentication security apikey api security

21/02 2014

1.0.0

1.0.0.0 https://helthe.co

Helthe API Security Component

  Sources   Download

MIT

The Requires

 

by Carl Alexander

api authentication security apikey api security