Skip to content

nomi-ramzan/test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

SNOOPYO ACR

##DESCRIPTION Guide of SNOOPYO ACR (Access Control Rules) for deployment and configure one node application.

Table of Contents

  1. Rule Types
  2. Rules Options
  3. Priority
  4. Examples

Rule Types

There are two types of rules which you can set.

Application Based

Rules based on node application instance

Routes Based

Rules based on node application Routes instance

Sample
{
	POST:{
	  BLOCK:{
	  	TYPE:[1, 2],
	  	PAYLOAD:{/*body:true, params:true, query:true*/}
	  },
	  REQ_LIST:{
	  	query:[],
	  	body:[ 'line', 'skipLog', 'query', 'appid' ],
	  	headers:['snoopyo-apikey', 'authorization']
	  },
	  ACL:['write','admin','listind'],
	  BLIST:{
	  	body:{ skipLog:[true] }
	  	, query:{}
	  	, params:  {}
	  	, headers: {}
	  }
	}
	, GET:{ ... }
}

Rules Options

ACL (Access Control List)

ACL option defines that which rules set of token can access this API. Its value is an array of strings.

Type : Array or undefined/null.

Default : According to Priority

Examples

  1. value: undefined,null

valid: any

  1. value: ['admin', 'search']

valid: ['admin'], ['search'], ['admin', 'search']

invalid: ['read'], ['write'], ['any', '...']

NOTE ACL will apply only if it defined

BLOCK

BLOCK Reject that request which will meet this criteria. And have two properties(options) TYPE and PAYLOAD. And selection will be According to Priority

Type : Object.

Structure : {TYPE: Single criteria , PAYLOAD:{ Payload criteria }}

Default : undefined

Examples

Types of criteria

Single criteria
  • Integer

    Exact match of integer

    valid: 1, 2, any integer

    invalid: a, b, any non-integer

  • String

    Exact match of string

    valid: "string", any string

    invalid: a, b, any non-integer

  • RegExp

    Test with RegExp

Examples

  1. value: string**

    _valid_: All strings starts with `string`
    
    _invalid_: All strings do not start with `string`
    
Payload criteria

This will be Always an Object. and have these properties

  • body
  • query
  • params
  • headers

Priority

Here is priority of ACR.

Sample
// POST method ACR for api (`'/single/route(api)/'`)
{
	priority:4
	, POST:{priority:3}
	, '/single/route(api)/':{
		priority:2
		, POST:{ priority:1 }
	}
}

About

It is just test repo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published