2021-07-08 07:39:07 +00:00
|
|
|
import { Module } from '@nestjs/common';
|
2021-07-11 05:39:55 +00:00
|
|
|
import { AuthService } from '../../services/auth.service';
|
2021-07-08 07:39:07 +00:00
|
|
|
import { JwtStrategy } from './jwt.strategy';
|
|
|
|
|
import { PassportModule } from '@nestjs/passport';
|
|
|
|
|
import { JwtModule } from '@nestjs/jwt';
|
2021-07-11 05:39:55 +00:00
|
|
|
import { UsersService } from '../../services/users.service';
|
2021-07-08 07:39:07 +00:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2021-07-11 05:39:55 +00:00
|
|
|
import { User } from '../../entities/user.entity';
|
2021-07-19 05:42:16 +00:00
|
|
|
import { Organization } from '../../entities/organization.entity';
|
|
|
|
|
import { OrganizationUser } from '../../entities/organization_user.entity';
|
2021-07-11 05:39:55 +00:00
|
|
|
import { UsersModule } from '../users/users.module';
|
2021-07-19 05:42:16 +00:00
|
|
|
import { OrganizationsService } from 'src/services/organizations.service';
|
|
|
|
|
import { OrganizationUsersService } from 'src/services/organization_users.service';
|
2021-07-18 20:34:45 +00:00
|
|
|
import { ConfigService } from '@nestjs/config';
|
2021-07-26 14:30:12 +00:00
|
|
|
import { EmailService } from '@services/email.service';
|
2022-01-27 09:51:17 +00:00
|
|
|
import { OauthService, GoogleOAuthService, GitOAuthService } from '@ee/services/oauth';
|
2021-11-17 11:21:50 +00:00
|
|
|
import { OauthController } from '@ee/controllers/oauth.controller';
|
2021-10-11 15:15:58 +00:00
|
|
|
import { GroupPermission } from 'src/entities/group_permission.entity';
|
2021-10-25 08:35:32 +00:00
|
|
|
import { App } from 'src/entities/app.entity';
|
2022-06-02 06:49:49 +00:00
|
|
|
import { File } from 'src/entities/file.entity';
|
|
|
|
|
import { FilesService } from '@services/files.service';
|
2022-05-05 07:08:42 +00:00
|
|
|
import { SSOConfigs } from 'src/entities/sso_config.entity';
|
|
|
|
|
import { GroupPermissionsService } from '@services/group_permissions.service';
|
|
|
|
|
import { AppGroupPermission } from 'src/entities/app_group_permission.entity';
|
|
|
|
|
import { UserGroupPermission } from 'src/entities/user_group_permission.entity';
|
|
|
|
|
import { EncryptionService } from '@services/encryption.service';
|
2021-07-08 07:39:07 +00:00
|
|
|
|
|
|
|
|
@Module({
|
|
|
|
|
imports: [
|
|
|
|
|
UsersModule,
|
|
|
|
|
PassportModule,
|
2022-05-05 07:08:42 +00:00
|
|
|
TypeOrmModule.forFeature([
|
|
|
|
|
User,
|
2022-06-02 06:49:49 +00:00
|
|
|
File,
|
2022-05-05 07:08:42 +00:00
|
|
|
Organization,
|
|
|
|
|
OrganizationUser,
|
|
|
|
|
GroupPermission,
|
|
|
|
|
App,
|
|
|
|
|
SSOConfigs,
|
|
|
|
|
AppGroupPermission,
|
|
|
|
|
UserGroupPermission,
|
|
|
|
|
]),
|
2021-07-18 20:34:45 +00:00
|
|
|
JwtModule.registerAsync({
|
|
|
|
|
useFactory: (config: ConfigService) => {
|
|
|
|
|
return {
|
|
|
|
|
secret: config.get<string>('SECRET_KEY_BASE'),
|
|
|
|
|
signOptions: {
|
2021-09-21 13:48:28 +00:00
|
|
|
expiresIn: config.get<string | number>('JWT_EXPIRATION_TIME') || '30d',
|
2021-07-18 20:34:45 +00:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
inject: [ConfigService],
|
2021-07-08 07:39:07 +00:00
|
|
|
}),
|
|
|
|
|
],
|
2021-11-17 11:21:50 +00:00
|
|
|
providers: [
|
|
|
|
|
AuthService,
|
|
|
|
|
JwtStrategy,
|
|
|
|
|
UsersService,
|
|
|
|
|
OrganizationsService,
|
|
|
|
|
OrganizationUsersService,
|
|
|
|
|
EmailService,
|
|
|
|
|
OauthService,
|
|
|
|
|
GoogleOAuthService,
|
2022-01-27 09:51:17 +00:00
|
|
|
GitOAuthService,
|
2022-06-02 06:49:49 +00:00
|
|
|
FilesService,
|
2022-05-05 07:08:42 +00:00
|
|
|
GroupPermissionsService,
|
|
|
|
|
EncryptionService,
|
2021-11-17 11:21:50 +00:00
|
|
|
],
|
|
|
|
|
controllers: [OauthController],
|
2021-07-08 07:39:07 +00:00
|
|
|
exports: [AuthService],
|
|
|
|
|
})
|
2021-07-18 20:34:45 +00:00
|
|
|
export class AuthModule {}
|