Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
// Node module: @loopback/authentication
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {bind, Component, ContextTags, ProviderMap} from '@loopback/core';
import {AuthenticationBindings} from './keys';
import {
AuthenticateActionProvider,
AuthenticationStrategyProvider,
AuthMetadataProvider,
} from './providers';
@bind({tags: {[ContextTags.KEY]: AuthenticationBindings.COMPONENT}})
export class AuthenticationComponent implements Component {
providers?: ProviderMap;
constructor() {
this.providers = {
[AuthenticationBindings.AUTH_ACTION.key]: AuthenticateActionProvider,
[AuthenticationBindings.STRATEGY.key]: AuthenticationStrategyProvider,
[AuthenticationBindings.METADATA.key]: AuthMetadataProvider,
};
}
}
// Copyright IBM Corp. 2018. All Rights Reserved.
// Node module: @loopback/authorization
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {
bind,
Component,
ContextTags,
createBindingFromClass,
} from '@loopback/core';
import {AuthorizationInterceptor} from './authorize-interceptor';
import {AuthorizationBindings} from './keys';
@bind({tags: {[ContextTags.KEY]: AuthorizationBindings.COMPONENT.key}})
export class AuthorizationComponent implements Component {
bindings = [createBindingFromClass(AuthorizationInterceptor)];
}
*/
export type LoggingComponentConfig = {
/**
* A flag to enable fluent, default to `true`
*/
enableFluent?: boolean;
/**
* A flag to enable Winston-based http access log, default to `true`
*/
enableHttpAccessLog?: boolean;
};
/**
* A component providing logging facilities
*/
@bind({tags: {[ContextTags.KEY]: LoggingBindings.COMPONENT}})
export class LoggingComponent implements Component {
providers: ProviderMap;
bindings: Binding[];
constructor(
@config()
loggingConfig: LoggingComponentConfig | undefined,
) {
loggingConfig = {
enableFluent: true,
enableHttpAccessLog: true,
...loggingConfig,
};
this.providers = {
[LoggingBindings.WINSTON_LOGGER.key]: WinstonLoggerProvider,
[LoggingBindings.WINSTON_INVOCATION_LOGGER