2017 © Pedro Peláez
 

symfony-bundle afc-tokens

Token service

image

umbrella-evgeny-nefedkin/afc-tokens

Token service

  • Friday, July 20, 2018
  • by umbrella-evgeny-nefedkin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

AFCTokenBundle

Generate key pair:, (*1)

openssl rsa -in private.pem -outform PEM -pubout -out public.pem, (*2)

Install

  1. Add to composer: composer require umbrella-evgeny-nefedkin/afc-tokens, (*3)

  2. Import, (*4)

    ```imports:, (*5)

    • { resource: '{path-to-vendor}/vendor/umbrella-evgeny-nefedkin/afc-tokens/src/Resources/config/services.yml' } ```

or override services:, (*6)

    parameters:
        umbrella.afct.param.secret: "%env(AFCT_SECRET)%"
        umbrella.afct.param.public_file: "%env(AFCT_PUBLIC_PATH)%"
        umbrella.afct.param.private_file: "%env(AFCT_PRIVATE_PATH)%"


    services:
        _defaults:
            autowire: false      # Automatically injects dependencies in your services.
            autoconfigure: false # Automatically registers your services as commands, event subscribers, etc.
            public: true         # this makes public all the services defined in this file


        umbrella.afct.service:
            class: Umbrella\AFCTokenBundle\Service\TokenService
            arguments: []




        umbrella.afct.key_public.file:
            class: Umbrella\AFCTokenBundle\Service\CryptKey\FileKey
            arguments: ["%umbrella.afct.param.public_file%"]

        umbrella.afct.key_private.file:
            class: Umbrella\AFCTokenBundle\Service\CryptKey\FileKey
            arguments: ["%umbrella.afct.param.private_file%"]




        umbrella.afct.serializer:
            class: Umbrella\AFCTokenBundle\Service\TokenSerializerService
            arguments: ["%umbrella.afct.param.secret%", "@umbrella.afct.key_private.file"]

        umbrella.afct.deserializer:
            class: Umbrella\AFCTokenBundle\Service\TokenDeserializerService
            arguments: ["%umbrella.afct.param.secret%", "@umbrella.afct.key_public.file"]
  1. Add environments (optional):, (*7)

    ###> afct ###
    AFCT_SECRET=22b1cc6b49273b7816041eb7e39e9604
    AFCT_PUBLIC_PATH="path/to/public.key"
    AFCT_PRIVATE_PATH="path/to/private.key"
    ###< afct ###
    
  2. Extends controller (optional):, (*8)

    class MyController extends TokenController
    {
        /**
         * @return \Umbrella\AFCTokenBundle\TokenDeserializerInterface
         */
        protected function getDeserializer(): TokenDeserializerInterface {
            return $this->get('umbrella.afct.deserializer');
        }
    
        /**
         * @return \Umbrella\AFCTokenBundle\TokenServiceInterface
         */
        protected function getTokenService(): TokenServiceInterface {
            return $this->get('umbrella.afct.service');
        }
    
        ....
    }
    
    

The Versions