Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {BootMixin} from '@loopback/boot';
- import {ApplicationConfig} from '@loopback/core';
- import {RestExplorerBindings, RestExplorerComponent} from '@loopback/rest-explorer';
- import {RepositoryMixin} from '@loopback/repository';
- import {RestApplication} from '@loopback/rest';
- import {ServiceMixin} from '@loopback/service-proxy';
- import * as path from 'path';
- import {MySequence} from './sequence';
- import {AuthenticationComponent, AuthenticationBindings} from '@loopback/authentication';
- import {MyAuthMetadataProvider, MyAuthStrategyProvider, MyAuthActionProvider} from './auth';
- export class Lb4JwtRoleBasedAuthSampleApplication extends BootMixin(ServiceMixin(RepositoryMixin(RestApplication))) {
- constructor(options: ApplicationConfig = {}) {
- super(options);
- // Set up the custom sequence
- this.sequence(MySequence);
- // Set up default home page
- this.static('/', path.join(__dirname, '../public'));
- // Customize @loopback/rest-explorer configuration here
- this.bind(RestExplorerBindings.CONFIG).to({
- path: '/explorer',
- });
- this.component(RestExplorerComponent);
- // enable authenticationcomponent
- this.component(AuthenticationComponent);
- // bind authentication bindings to our custom providers
- this.bind(AuthenticationBindings.METADATA).toProvider(MyAuthMetadataProvider);
- this.bind(AuthenticationBindings.STRATEGY).toProvider(MyAuthStrategyProvider);
- this.bind(AuthenticationBindings.AUTH_ACTION).toProvider(MyAuthActionProvider);
- this.projectRoot = __dirname;
- // Customize @loopback/boot Booter Conventions here
- this.bootOptions = {
- controllers: {
- // Customize ControllerBooter Conventions here
- dirs: ['controllers'],
- extensions: ['.controller.js'],
- nested: true,
- },
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement