Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 3p
import { controller } from '@foal/core';
export class MyModule {
controllers = [
controller('/', MyController),
controller('/', MyController2)
];
}
@LoginRequired({ user: fetchUser(User) })
class OrgController extends RestController {
@dependency
collection: OrgCollection;
}
class AuthController extends LoginController {
strategies = [
strategy('login', Authenticator, {})
];
}
class AppController {
subControllers = [
controller('/users', UserController),
controller('/orgs', OrgController),
controller('', AuthController),
];
}
const app = createApp(AppController);
/* Create orgs, perms, groups and users */
await createConnection({
database: 'e2e_db.sqlite',
dropSchema: true,
entities: [ User, Permission, Group, Org ],
name: 'create-connection',
synchronize: true,
type: 'sqlite',
});
// 3p
import { controller } from '@foal/core';
import { TestFooBarController } from './controllers';
export class MyModule {
controllers = [
controller('/', MyController),
controller('/', MyController2),
controller('/', TestFooBarController)
];
}
// 3p
import { controller } from '@foal/core';
export class MyModule {
controllers = [
controller('/', MyController),
controller('/', MyController2)
];
}
// 3p
import { controller } from '@foal/core';
import { TestFooBarController } from './controllers';
export class MyModule {
controllers = [
controller('/', MyController),
controller('/', MyController2),
controller('/', TestFooBarController)
];
}
return reject(err);
}
resolve(value);
});
});
return new HttpResponseOK({
token
});
}
}
class AppController {
subControllers = [
AuthController,
controller('/api', ApiController),
];
}
before(async () => {
process.env.SETTINGS_JWT_SECRET_OR_PUBLIC_KEY = 'session-secret';
await createConnection({
database: 'e2e_db.sqlite',
dropSchema: true,
entities: [ User ],
synchronize: true,
type: 'sqlite',
});
blackList = [];
app = createApp(AppController);
scopes: {
'read:pets': 'read your pets',
'write:pets': 'modify pets in your account',
}
}
},
type: 'oauth2',
})
@ApiDefineSecurityScheme('api_key', {
in: 'header',
name: 'api_key',
type: 'apiKey',
})
class ApiController {
subControllers = [
controller('/pet', PetController),
controller('/store', StoreController),
controller('/user', UserController),
];
}
@ApiUseTag('pet')
@ApiDefineSchema('Category', {
properties: {
id: {
format: 'int64',
type: 'integer',
},
name: { type: 'string' }
},
type: 'object',
xml: { name: 'Category' }
@TokenRequired({
cookie: true,
store: TypeORMStore,
})
@CsrfTokenRequired()
class ApiController {
@Post('/products')
createProduct() {
return new HttpResponseCreated();
}
}
class AppController {
subControllers = [
AuthController,
controller('/api', ApiController),
];
}
before(async () => {
process.env.SETTINGS_SESSION_SECRET = 'session-secret';
await createConnection({
database: 'e2e_db.sqlite',
dropSchema: true,
synchronize: true,
type: 'sqlite',
});
app = createApp(AppController);
});
after(async () => {
cookie: true,
extendLifeTimeOrUpdate: false,
store: TypeORMStore,
})
async logout(ctx: Context) {
await this.store.destroy(ctx.session.sessionID);
const response = new HttpResponseNoContent();
removeSessionCookie(response);
return response;
}
}
class AppController {
subControllers = [
AuthController,
controller('/api', ApiController),
];
}
before(async () => {
process.env.SETTINGS_SESSION_SECRET = 'session-secret';
await createConnection({
database: 'e2e_db.sqlite',
dropSchema: true,
entities: [ User ],
synchronize: true,
type: 'sqlite',
});
app = createApp(AppController);
});
import { controller, IModule, Module } from '@foal/core';
import { AuthController } from './controllers/auth.controller';
import { ViewController } from './controllers/view.controller';
@Module()
export class AuthModule implements IModule {
controllers = [
controller('', AuthController),
controller('', ViewController),
];
}