Skip to content

Commit

Permalink
IEncryptionService -> EncryptionService
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfganggreschus committed Nov 13, 2023
1 parent 94b8412 commit 1127a05
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/infra/encryption/encryption.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const DefaultEncryptionService = Symbol('DefaultEncryptionService');
export const LdapEncryptionService = Symbol('LdapEncryptionService');

export interface IEncryptionService {
export interface EncryptionService {
encrypt(data: string): string;
decrypt(data: string): string;
}
4 changes: 2 additions & 2 deletions apps/server/src/infra/encryption/encryption.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import CryptoJs from 'crypto-js';

import { Injectable } from '@nestjs/common';
import { LegacyLogger } from '@src/core/logger';
import { IEncryptionService } from './encryption.interface';
import { EncryptionService } from './encryption.interface';

@Injectable()
export class SymetricKeyEncryptionService implements IEncryptionService {
export class SymetricKeyEncryptionService implements EncryptionService {
constructor(private logger: LegacyLogger, private key?: string) {
if (!this.key) {
this.logger.warn('No AES key defined. Encryption will no work');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { DefaultEncryptionService, EncryptionService } from '@infra/encryption';
import IdentityProviderRepresentation from '@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation';
import { Inject } from '@nestjs/common';
import { DefaultEncryptionService, IEncryptionService } from '@infra/encryption';
import { OidcConfigDto } from '@modules/system/service';
import { Inject } from '@nestjs/common';

export class OidcIdentityProviderMapper {
constructor(@Inject(DefaultEncryptionService) private readonly defaultEncryptionService: IEncryptionService) {}
constructor(@Inject(DefaultEncryptionService) private readonly defaultEncryptionService: EncryptionService) {}

public mapToKeycloakIdentityProvider(oidcConfig: OidcConfigDto, flowAlias: string): IdentityProviderRepresentation {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DefaultEncryptionService, EncryptionService } from '@infra/encryption';
import { OauthConfigDto } from '@modules/system/service';
import { HttpService } from '@nestjs/axios';
import { Inject, Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { DefaultEncryptionService, IEncryptionService } from '@infra/encryption';
import { OauthConfigDto } from '@modules/system/service';
import qs from 'qs';
import { lastValueFrom } from 'rxjs';
import { IdentityManagementOauthService } from '../../identity-management-oauth.service';
Expand All @@ -16,7 +16,7 @@ export class KeycloakIdentityManagementOauthService extends IdentityManagementOa
private readonly kcAdminService: KeycloakAdministrationService,
private readonly configService: ConfigService,
private readonly httpService: HttpService,
@Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: IEncryptionService
@Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: EncryptionService
) {
super();
}
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/modules/management/uc/database-management.uc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Configuration } from '@hpi-schul-cloud/commons';
import { DatabaseManagementService } from '@infra/database';
import { DefaultEncryptionService, EncryptionService, LdapEncryptionService } from '@infra/encryption';
import { FileSystemAdapter } from '@infra/file-system';
import { EntityManager } from '@mikro-orm/mongodb';
import { Inject, Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { StorageProviderEntity, SystemEntity } from '@shared/domain';
import { DatabaseManagementService } from '@infra/database';
import { DefaultEncryptionService, IEncryptionService, LdapEncryptionService } from '@infra/encryption';
import { FileSystemAdapter } from '@infra/file-system';
import { LegacyLogger } from '@src/core/logger';
import { orderBy } from 'lodash';
import { BsonConverter } from '../converter/bson.converter';
Expand Down Expand Up @@ -35,8 +35,8 @@ export class DatabaseManagementUc {
private readonly configService: ConfigService,
private readonly logger: LegacyLogger,
private em: EntityManager,
@Inject(DefaultEncryptionService) private readonly defaultEncryptionService: IEncryptionService,
@Inject(LdapEncryptionService) private readonly ldapEncryptionService: IEncryptionService
@Inject(DefaultEncryptionService) private readonly defaultEncryptionService: EncryptionService,
@Inject(LdapEncryptionService) private readonly ldapEncryptionService: EncryptionService
) {
this.logger.setContext(DatabaseManagementUc.name);
}
Expand Down
12 changes: 6 additions & 6 deletions apps/server/src/modules/oauth/service/hydra.service.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { DefaultEncryptionService, EncryptionService } from '@infra/encryption';
import { AuthorizationParams } from '@modules/oauth/controller/dto/authorization.params';
import { CookiesDto } from '@modules/oauth/service/dto/cookies.dto';
import { HydraRedirectDto } from '@modules/oauth/service/dto/hydra.redirect.dto';
import { HttpService } from '@nestjs/axios';
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator';
import { OauthConfig } from '@shared/domain';
import { LtiToolDO } from '@shared/domain/domainobject/ltitool.do';
import { DefaultEncryptionService, IEncryptionService } from '@infra/encryption';
import { LtiToolRepo } from '@shared/repo';
import { LegacyLogger } from '@src/core/logger';
import { AuthorizationParams } from '@modules/oauth/controller/dto/authorization.params';
import { CookiesDto } from '@modules/oauth/service/dto/cookies.dto';
import { HydraRedirectDto } from '@modules/oauth/service/dto/hydra.redirect.dto';
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import { nanoid } from 'nanoid';
import QueryString from 'qs';
import { Observable, firstValueFrom } from 'rxjs';
import { firstValueFrom, Observable } from 'rxjs';

@Injectable()
export class HydraSsoService {
constructor(
private readonly ltiRepo: LtiToolRepo,
private readonly httpService: HttpService,
@Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: IEncryptionService,
@Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: EncryptionService,
private readonly logger: LegacyLogger
) {}

Expand Down
16 changes: 8 additions & 8 deletions apps/server/src/modules/oauth/service/oauth.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Configuration } from '@hpi-schul-cloud/commons';
import { Inject } from '@nestjs/common';
import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator';
import { EntityId, LegacySchoolDo, OauthConfig, SchoolFeatures, UserDO } from '@shared/domain';
import { DefaultEncryptionService, IEncryptionService } from '@infra/encryption';
import { LegacyLogger } from '@src/core/logger';
import { DefaultEncryptionService, EncryptionService } from '@infra/encryption';
import { LegacySchoolService } from '@modules/legacy-school';
import { ProvisioningService } from '@modules/provisioning';
import { OauthDataDto } from '@modules/provisioning/dto';
import { LegacySchoolService } from '@modules/legacy-school';
import { SystemService } from '@modules/system';
import { SystemDto } from '@modules/system/service';
import { UserService } from '@modules/user';
import { MigrationCheckService, UserMigrationService } from '@modules/user-login-migration';
import { Inject } from '@nestjs/common';
import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator';
import { EntityId, LegacySchoolDo, OauthConfig, SchoolFeatures, UserDO } from '@shared/domain';
import { LegacyLogger } from '@src/core/logger';
import jwt, { JwtPayload } from 'jsonwebtoken';
import { OAuthSSOError, SSOErrorCode, UserNotFoundAfterProvisioningLoggableException } from '../loggable';
import { OAuthTokenDto } from '../interface';
import { OAuthSSOError, SSOErrorCode, UserNotFoundAfterProvisioningLoggableException } from '../loggable';
import { TokenRequestMapper } from '../mapper/token-request.mapper';
import { AuthenticationCodeGrantTokenRequest, OauthTokenResponse } from './dto';
import { OauthAdapterService } from './oauth-adapter.service';
Expand All @@ -23,7 +23,7 @@ export class OAuthService {
constructor(
private readonly userService: UserService,
private readonly oauthAdapterService: OauthAdapterService,
@Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: IEncryptionService,
@Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: EncryptionService,
private readonly logger: LegacyLogger,
private readonly provisioningService: ProvisioningService,
private readonly systemService: SystemService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Inject, Injectable, UnprocessableEntityException } from '@nestjs/common';
import { EntityId, IFindOptions, Page } from '@shared/domain';
import { DefaultEncryptionService, IEncryptionService } from '@infra/encryption';
import { DefaultEncryptionService, EncryptionService } from '@infra/encryption';
import { OauthProviderService } from '@infra/oauth-provider';
import { ProviderOauthClient } from '@infra/oauth-provider/dto';
import { Inject, Injectable, UnprocessableEntityException } from '@nestjs/common';
import { EntityId, IFindOptions, Page } from '@shared/domain';
import { ContextExternalToolRepo, ExternalToolRepo, SchoolExternalToolRepo } from '@shared/repo';
import { LegacyLogger } from '@src/core/logger';
import { TokenEndpointAuthMethod } from '../../common/enum';
Expand All @@ -20,7 +20,7 @@ export class ExternalToolService {
private readonly mapper: ExternalToolServiceMapper,
private readonly schoolExternalToolRepo: SchoolExternalToolRepo,
private readonly contextExternalToolRepo: ContextExternalToolRepo,
@Inject(DefaultEncryptionService) private readonly encryptionService: IEncryptionService,
@Inject(DefaultEncryptionService) private readonly encryptionService: EncryptionService,
private readonly legacyLogger: LegacyLogger,
private readonly externalToolVersionService: ExternalToolVersionService
) {}
Expand Down

0 comments on commit 1127a05

Please sign in to comment.