2017 © Pedro Peláez
 

symfony-bundle jwt-security-bundle

Symfony bundle for use JWT for authorization, authentication.

image

php-solution/jwt-security-bundle

Symfony bundle for use JWT for authorization, authentication.

  • Friday, June 1, 2018
  • by olesav
  • Repository
  • 6 Watchers
  • 0 Stars
  • 89 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 21 Versions
  • 9 % Grown

The README.md

JwtSecurityBundle

This bundle allows developer to use JWT for authorization/authentication on api application., (*1)

Configuration

Configure JWT in your config.yaml:, (*2)

jwt:
  default_configuration: 'common'
  configurations:
    common:
      asymmetric: true
      signer:
        class: 'Lcobucci\JWT\Signer\Rsa\Sha512'
      signing_key:
        content: 'file://%kernel.project_dir%/etc/jwt/keys/private.pem'
        pass: 'test'
      verification_key:
        content: 'file://%kernel.project_dir%/etc/jwt/keys/public.pub'
  types:
    authentication:
      configuration: 'common'
      exp: 3600

Configure authorization JWT in your config.yaml:, (*3)

jwt_security:
  auth_header:
      name: 'Authorization'
      prefix: 'Bearer '
  token_provider:
      token_type: 'authentication'
      claim_user: 'user'

Configure security in your security.yaml:, (*4)

security:
    providers:
        your_user_provider: # provider name
            ...    
    firewalls:        
        api_login:
            pattern: '^/login'
            stateless: true
            anonymous: true
            json_login:
                check_path: '/login'
                success_handler: 'jwt_security.security.authorization_handler'
                failure_handler: 'jwt_security.security.authorization_handler'
        api_secured:
            pattern: '^/'
            stateless: true
            provider: 'in_memory_users'
            guard:
                authenticators: ['jwt_security.security.authenticator']
access_control:
    - { path: '^/login', roles: 'IS_AUTHENTICATED_ANONYMOUSLY' }
    - { path: '^/', roles: 'IS_AUTHENTICATED_FULLY' }        

Add route for check login:, (*5)

api_security:
  resource: '@JwtSecurityBundle/Resources/config/routing.yml'     

or, (*6)

_jwt_security_login:
    path: '/login'
    defaults: { _controller: 'PhpSolution\JwtSecurityBundle\Controller\SecurityController::loginAction', _format: 'json' }

The Versions

01/06 2018
14/12 2017
15/06 2017

v0.1.1

0.1.1.0

Symfony bundle for use JWT for authorization, authentication.

  Sources   Download

MIT

The Requires

 

by Oleksandr Savchenko

15/06 2017

v0.1

0.1.0.0

Symfony bundle for use JWT for authorization, authentication.

  Sources   Download

MIT

The Requires

 

by Oleksandr Savchenko