##DESCRIPTION Guide of SNOOPYO ACR (Access Control Rules) for deployment and configure one node application.
There are two types of rules which you can set.
Rules based on node application instance
Rules based on node application Routes instance
{
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:{ ... }
}
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
- value:
undefined
,null
valid: any
- value:
['admin', 'search']
valid: ['admin']
, ['search']
, ['admin', 'search']
invalid: ['read']
, ['write']
, ['any', '...']
NOTE ACL will apply only if it defined
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
-
Integer
Exact match of integer
valid:
1
,2
, any integerinvalid:
a
,b
, any non-integer -
String
Exact match of string
valid:
"string"
, any stringinvalid:
a
,b
, any non-integer -
RegExp
Test with RegExp
Examples
-
value:
string**
_valid_: All strings starts with `string` _invalid_: All strings do not start with `string`
This will be Always an Object. and have these properties
- body
- query
- params
- headers
Here is priority of ACR.
// POST method ACR for api (`'/single/route(api)/'`)
{
priority:4
, POST:{priority:3}
, '/single/route(api)/':{
priority:2
, POST:{ priority:1 }
}
}