0.0.3 • Published 5 months ago
casbin-authorization v0.0.3
casbin-authorization
Installation
Install CasbinAuthorizationComponent using npm
;
$ [npm install | yarn add] casbin-authorization
Basic Use
Configure and load CasbinAuthorizationComponent in the application constructor as shown below.
import {CasbinAuthorizationComponent, CasbinAuthorizationComponentOptions, DEFAULT_CASBIN_AUTHORIZATION_OPTIONS} from 'casbin-authorization';
// ...
export class MyApplication extends BootMixin(ServiceMixin(RepositoryMixin(RestApplication))) {
constructor(options: ApplicationConfig = {}) {
const opts: CasbinAuthorizationComponentOptions = DEFAULT_CASBIN_AUTHORIZATION_OPTIONS;
this.configure(CasbinAuthorizationComponentBindings.COMPONENT).to(opts);
// Put the configuration options here
});
this.component(CasbinAuthorizationComponent);
// ...
}
// ...
}