Skip to content

AnandPilania/f3-token-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

f3-token-middleware

Just pass your token secure routes [/ OR '/secure/*'] & handler to f3-token-middleware & relax... it will check requests pattern + token & execute your handler if token not found.

NOTE: This package built/ported from ikkez/f3-middleware.

CHECK example.file for sample

Install

  `composer require anandpilania/f3-token-middleware`

## Usage

  • 1: Configure f3:

    `$f3->mset(array(
    
        'TOKEN' => array(
      	  'TYPE' => 'HEADER', // HEADER|QUERY
      	  
            'KEY' => 'Authorization', // TOKEN KEY
            
            'STARTS_WITH' => 'X-Auth-Token', // TOKEN KEY STARTS WITH (supports only HEADER type) -> "Authorization: X-Auth-Token xxxxxxxx"
            
            'TABLE' => 'Models\Token', // FQCN
            
            'TABLE_KEY' => 'token' // KEY, which you used to store the token value in table
            
        )
        
    ));`
    
  • 2: Initialize in your main bootstrap file:

    `$tokenMiddleware = new TokenMiddleware();`
    
  • 3: Protect routes/pattern:

    `$tokenMiddleware->protect(array('GET|POST|PUT|DELETE /home/*', 'POST /profile'), function($f3, $params, $alias) {
    
        // YOUR FUNCTION, IF 'TOKEN' NOT SUPPLIED
        
    });`
    
  • 4: RUN:

    `$tokenMiddleware->run();`
    

About

Token authentication middleware for FatFreeFramework

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy