scope-validator
v1.2.0
Published
Pattern matching based Oauth2.0 scope validation library
Downloads
9
Readme
Scope Validator
Pattern matching based Oauth2.0 scope validation library
Installation
$ npm install scope-validator
Documentation
Documentation / scope-validator
Example
import { ScopeValidatorFactory, ScopeValidatorManager } from 'scope-vallidator'
const ParameterValidator = ScopeValidatorFactory.create(
'create_test:${custom_param}',
(name: string, { parameters }) => {
const { custom_param } = parameters;
if (custom_param === 'hello') {
return true
}
return false
}
)
const validatorManager = new ScopeValidatorManager();
validatorManager.use(ParameterValidator);
validatorManager.validate(['create_test:hello']);