Giter Club home page Giter Club logo

afctokenbundle's Introduction

AFCTokenBundle

Generate key pair:

openssl rsa -in private.pem -outform PEM -pubout -out public.pem

##Install

  1. Add to composer: composer require umbrella-evgeny-nefedkin/afc-tokens

  2. Import

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

or override services:

	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):

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

    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');
    	}
    	
    	....
    }
    
    

afctokenbundle's People

Watchers

Evgeny Nefedkin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.