diff --git a/alfa-client/.gitignore b/alfa-client/.gitignore index 6116ea3d904921685f791527ee0ec33f12136fa8..82940fc64c73f76b3c97bc2e4f5a4d69a2aef4cc 100644 --- a/alfa-client/.gitignore +++ b/alfa-client/.gitignore @@ -49,3 +49,5 @@ testem.log .DS_Store Thumbs.db + +.angular diff --git a/alfa-client/libs/authentication/.eslintrc.json b/alfa-client/libs/authentication/.eslintrc.json new file mode 100644 index 0000000000000000000000000000000000000000..b953e5d37d40148217ab14a01859ea0cb43d9ebc --- /dev/null +++ b/alfa-client/libs/authentication/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "lib", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "lib", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/alfa-client/libs/authentication/README.md b/alfa-client/libs/authentication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..927d463c287071179f81c12ec68a6f88fb777e18 --- /dev/null +++ b/alfa-client/libs/authentication/README.md @@ -0,0 +1,7 @@ +# authentication + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test authentication` to execute the unit tests. diff --git a/alfa-client/libs/authentication/jest.config.ts b/alfa-client/libs/authentication/jest.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d9be36ab97b9dcdffca41df8ae346c05abbc719 --- /dev/null +++ b/alfa-client/libs/authentication/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'authentication', + preset: '../../jest.preset.js', + setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], + coverageDirectory: '../../coverage/libs/authentication', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '<rootDir>/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + ], + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +}; diff --git a/alfa-client/libs/authentication/project.json b/alfa-client/libs/authentication/project.json new file mode 100644 index 0000000000000000000000000000000000000000..32c2f511abfdc54eaf66bbff2b72e38af9484fad --- /dev/null +++ b/alfa-client/libs/authentication/project.json @@ -0,0 +1,31 @@ +{ + "name": "authentication", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/authentication/src", + "prefix": "lib", + "tags": [], + "projectType": "library", + "targets": { + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/authentication/jest.config.ts", + "passWithNoTests": true + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/authentication/**/*.ts", "libs/authentication/**/*.html"] + } + } + } +} diff --git a/alfa-client/libs/authentication/src/index.ts b/alfa-client/libs/authentication/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..9011039eac9aa2338af510653b01583e6523f251 --- /dev/null +++ b/alfa-client/libs/authentication/src/index.ts @@ -0,0 +1 @@ +export * from './lib/authentication.module'; diff --git a/alfa-client/libs/authentication/src/lib/authentication.module.ts b/alfa-client/libs/authentication/src/lib/authentication.module.ts new file mode 100644 index 0000000000000000000000000000000000000000..684f02e422a37c20ec64ebc6db8db3a5a06dede2 --- /dev/null +++ b/alfa-client/libs/authentication/src/lib/authentication.module.ts @@ -0,0 +1,7 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + imports: [CommonModule], +}) +export class AuthenticationModule {} diff --git a/alfa-client/apps/admin/src/common/auth/auth.service.spec.ts b/alfa-client/libs/authentication/src/lib/authentication.service.spec.ts similarity index 100% rename from alfa-client/apps/admin/src/common/auth/auth.service.spec.ts rename to alfa-client/libs/authentication/src/lib/authentication.service.spec.ts diff --git a/alfa-client/apps/admin/src/common/auth/auth.service.ts b/alfa-client/libs/authentication/src/lib/authentication.service.ts similarity index 100% rename from alfa-client/apps/admin/src/common/auth/auth.service.ts rename to alfa-client/libs/authentication/src/lib/authentication.service.ts diff --git a/alfa-client/apps/admin/src/common/auth/auth.test.ts b/alfa-client/libs/authentication/src/lib/authentication.test.ts similarity index 100% rename from alfa-client/apps/admin/src/common/auth/auth.test.ts rename to alfa-client/libs/authentication/src/lib/authentication.test.ts diff --git a/alfa-client/apps/admin/src/common/interceptor/http-unauthorized.interceptor.spec.ts b/alfa-client/libs/authentication/src/lib/http-unauthorized.interceptor.spec.ts similarity index 100% rename from alfa-client/apps/admin/src/common/interceptor/http-unauthorized.interceptor.spec.ts rename to alfa-client/libs/authentication/src/lib/http-unauthorized.interceptor.spec.ts diff --git a/alfa-client/apps/admin/src/common/interceptor/http-unauthorized.interceptor.ts b/alfa-client/libs/authentication/src/lib/http-unauthorized.interceptor.ts similarity index 100% rename from alfa-client/apps/admin/src/common/interceptor/http-unauthorized.interceptor.ts rename to alfa-client/libs/authentication/src/lib/http-unauthorized.interceptor.ts diff --git a/alfa-client/libs/authentication/src/test-setup.ts b/alfa-client/libs/authentication/src/test-setup.ts new file mode 100644 index 0000000000000000000000000000000000000000..ab1eeeb335d7890571dda105cf8bc1ea77086866 --- /dev/null +++ b/alfa-client/libs/authentication/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true, + }, +}; +import 'jest-preset-angular/setup-jest'; diff --git a/alfa-client/libs/authentication/tsconfig.json b/alfa-client/libs/authentication/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..92049739f65e6a89dcd34bca26e34e0cafefc690 --- /dev/null +++ b/alfa-client/libs/authentication/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/alfa-client/libs/authentication/tsconfig.lib.json b/alfa-client/libs/authentication/tsconfig.lib.json new file mode 100644 index 0000000000000000000000000000000000000000..4cab05d46338c6e9d4dfe6512fd7eb7f60340d3d --- /dev/null +++ b/alfa-client/libs/authentication/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/alfa-client/libs/authentication/tsconfig.spec.json b/alfa-client/libs/authentication/tsconfig.spec.json new file mode 100644 index 0000000000000000000000000000000000000000..7870b7c011681fb77d6114001f44d3eeca69975b --- /dev/null +++ b/alfa-client/libs/authentication/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/alfa-client/tsconfig.base.json b/alfa-client/tsconfig.base.json index 273aa6f0fd7e8b8dc7bfe7e87a4f644820431bf8..1f7364bba7606a74a3d102427b82bb77ac3049cb 100644 --- a/alfa-client/tsconfig.base.json +++ b/alfa-client/tsconfig.base.json @@ -53,6 +53,7 @@ "@alfa-client/vorgang-shared-ui": ["libs/vorgang-shared-ui/src/index.ts"], "@alfa-client/wiedervorlage": ["libs/wiedervorlage/src/index.ts"], "@alfa-client/wiedervorlage-shared": ["libs/wiedervorlage-shared/src/index.ts"], + "authentication": ["libs/authentication/src/index.ts"], "design-system": ["libs/design-system/src/index.ts"] } },