diff --git a/apps/api/dev-tokens.md b/apps/api/dev-tokens.md index 3020a795..ad02d417 100644 --- a/apps/api/dev-tokens.md +++ b/apps/api/dev-tokens.md @@ -10,5 +10,5 @@ application of our AAD. | testuser | c0cc4404-7907-4480-86d3-ba4bfc513c6d | Test | User | testuser@kordis-leitstelle.de | testorganization (dff7584efe2c174eee8bae45) | `eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJvaWQiOiIxMjM0IiwiZW1haWxzIjpbInRlc3R1c2VyQHRlc3QuY29tIl0sImdpdmVuX25hbWUiOiJUZXN0IiwiZmFtaWx5X25hbWUiOiJVc2VyIDEifQ.` | The claims will be mapped to the -[AuthUser](../../libs/shared/auth/src/lib/auth-user.model.ts) Model in the +[AuthUser](../../libs/shared/model/src/lib/auth-user.model.ts) Model in the [AuthInterceptor](../../libs/api/auth/src/lib/interceptors/auth.interceptor.ts). diff --git a/libs/api/auth/src/lib/auth-user-extractor-strategies/auth-user-extractor.strategy.ts b/libs/api/auth/src/lib/auth-user-extractor-strategies/auth-user-extractor.strategy.ts index 8bd782ac..9bbb7c2a 100644 --- a/libs/api/auth/src/lib/auth-user-extractor-strategies/auth-user-extractor.strategy.ts +++ b/libs/api/auth/src/lib/auth-user-extractor-strategies/auth-user-extractor.strategy.ts @@ -1,6 +1,6 @@ import { Request } from 'express'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; export abstract class AuthUserExtractorStrategy { abstract getUserFromRequest(req: Request): AuthUser | null; diff --git a/libs/api/auth/src/lib/decorators/user.decorator.spec.ts b/libs/api/auth/src/lib/decorators/user.decorator.spec.ts index caac6394..8147cdbf 100644 --- a/libs/api/auth/src/lib/decorators/user.decorator.spec.ts +++ b/libs/api/auth/src/lib/decorators/user.decorator.spec.ts @@ -5,7 +5,7 @@ import { createGqlContextForRequest, createParamDecoratorFactory, } from '@kordis/api/test-helpers'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; import { User } from './user.decorator'; diff --git a/libs/api/auth/src/lib/interceptors/auth.interceptor.spec.ts b/libs/api/auth/src/lib/interceptors/auth.interceptor.spec.ts index c3f09d6c..8d45375c 100644 --- a/libs/api/auth/src/lib/interceptors/auth.interceptor.spec.ts +++ b/libs/api/auth/src/lib/interceptors/auth.interceptor.spec.ts @@ -7,7 +7,7 @@ import { createGqlContextForRequest, createHttpContextForRequest, } from '@kordis/api/test-helpers'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; import { AuthUserExtractorStrategy } from '../auth-user-extractor-strategies/auth-user-extractor.strategy'; import { AuthInterceptor } from './auth.interceptor'; diff --git a/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.spec.ts b/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.spec.ts index 73ec02a0..aea0766c 100644 --- a/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.spec.ts +++ b/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.spec.ts @@ -6,7 +6,7 @@ import { Observable, firstValueFrom, of } from 'rxjs'; import { KordisRequest } from '@kordis/api/shared'; import { createGqlContextForRequest } from '@kordis/api/test-helpers'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; import { SentryOTelUserContextInterceptor } from './sentry-otel-user-context.interceptor'; diff --git a/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.ts b/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.ts index 03d655cb..0130c554 100644 --- a/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.ts +++ b/libs/api/observability/src/lib/interceptors/sentry-otel-user-context.interceptor.ts @@ -10,7 +10,7 @@ import * as Sentry from '@sentry/node'; import { Observable } from 'rxjs'; import { KordisGqlContext, KordisRequest } from '@kordis/api/shared'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; @Injectable() export class SentryOTelUserContextInterceptor implements NestInterceptor { diff --git a/libs/api/shared/src/lib/models/request.model.ts b/libs/api/shared/src/lib/models/request.model.ts index a1919847..77977cc4 100644 --- a/libs/api/shared/src/lib/models/request.model.ts +++ b/libs/api/shared/src/lib/models/request.model.ts @@ -1,6 +1,6 @@ import { Request } from 'express'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; export interface KordisGqlContext { req: KordisRequest; diff --git a/libs/shared/auth/src/index.ts b/libs/shared/auth/src/index.ts deleted file mode 100644 index eb599854..00000000 --- a/libs/shared/auth/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as AuthUser } from './lib/auth-user.model'; diff --git a/libs/shared/auth/.eslintrc.json b/libs/shared/model/.eslintrc.json similarity index 100% rename from libs/shared/auth/.eslintrc.json rename to libs/shared/model/.eslintrc.json diff --git a/libs/shared/auth/project.json b/libs/shared/model/project.json similarity index 77% rename from libs/shared/auth/project.json rename to libs/shared/model/project.json index 20e2d92b..76ebef87 100644 --- a/libs/shared/auth/project.json +++ b/libs/shared/model/project.json @@ -1,7 +1,7 @@ { - "name": "shared-auth", + "name": "shared-model", "$schema": "../../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/shared/auth/src", + "sourceRoot": "libs/shared/model/src", "projectType": "library", "targets": { "lint": { diff --git a/libs/shared/model/src/index.ts b/libs/shared/model/src/index.ts new file mode 100644 index 00000000..6f3ce71b --- /dev/null +++ b/libs/shared/model/src/index.ts @@ -0,0 +1,2 @@ +export * from './lib/shared-model'; +export { default as AuthUser } from '../../model/src/lib/auth-user.model'; diff --git a/libs/shared/auth/src/lib/auth-user.model.ts b/libs/shared/model/src/lib/auth-user.model.ts similarity index 100% rename from libs/shared/auth/src/lib/auth-user.model.ts rename to libs/shared/model/src/lib/auth-user.model.ts diff --git a/libs/shared/auth/tsconfig.json b/libs/shared/model/tsconfig.json similarity index 100% rename from libs/shared/auth/tsconfig.json rename to libs/shared/model/tsconfig.json diff --git a/libs/shared/auth/tsconfig.lib.json b/libs/shared/model/tsconfig.lib.json similarity index 53% rename from libs/shared/auth/tsconfig.lib.json rename to libs/shared/model/tsconfig.lib.json index 0b5310b9..3383a9c9 100644 --- a/libs/shared/auth/tsconfig.lib.json +++ b/libs/shared/model/tsconfig.lib.json @@ -5,6 +5,6 @@ "declaration": true, "types": ["node"] }, - "include": ["src/**/*.ts", "../../../reset.d.ts"], - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] } diff --git a/libs/spa/auth/src/lib/components/dev-login.component.ts b/libs/spa/auth/src/lib/components/dev-login.component.ts index 427656a3..d70c95d5 100644 --- a/libs/spa/auth/src/lib/components/dev-login.component.ts +++ b/libs/spa/auth/src/lib/components/dev-login.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; import { FormBuilder, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; import { AUTH_SERVICE } from '../services/auth-service'; import { DevAuthService } from '../services/dev-auth.service'; diff --git a/libs/spa/auth/src/lib/services/auth-service.ts b/libs/spa/auth/src/lib/services/auth-service.ts index 85b34126..88d1ddf8 100644 --- a/libs/spa/auth/src/lib/services/auth-service.ts +++ b/libs/spa/auth/src/lib/services/auth-service.ts @@ -1,12 +1,14 @@ import { InjectionToken } from '@angular/core'; import { Observable } from 'rxjs'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; export interface AuthService { readonly user$: Observable; readonly isAuthenticated$: Observable; + login(): void; + logout(): void; } diff --git a/libs/spa/auth/src/lib/services/auth.service.ts b/libs/spa/auth/src/lib/services/auth.service.ts index cdf5d60f..fb1e8810 100644 --- a/libs/spa/auth/src/lib/services/auth.service.ts +++ b/libs/spa/auth/src/lib/services/auth.service.ts @@ -8,7 +8,7 @@ import { shareReplay, } from 'rxjs'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; import { AuthService } from './auth-service'; diff --git a/libs/spa/auth/src/lib/services/dev-auth.service.ts b/libs/spa/auth/src/lib/services/dev-auth.service.ts index 0338f41b..e2f6bd95 100644 --- a/libs/spa/auth/src/lib/services/dev-auth.service.ts +++ b/libs/spa/auth/src/lib/services/dev-auth.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { BehaviorSubject, Observable, map } from 'rxjs'; -import { AuthUser } from '@kordis/shared/auth'; +import { AuthUser } from '@kordis/shared/model'; import { AuthService } from './auth-service'; diff --git a/tsconfig.base.json b/tsconfig.base.json index 3c2fd85b..957cb7d3 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,7 +20,7 @@ "@kordis/api/organization": ["libs/api/organization/src/index.ts"], "@kordis/api/shared": ["libs/api/shared/src/index.ts"], "@kordis/api/test-helpers": ["libs/api/test-helpers/src/index.ts"], - "@kordis/shared/auth": ["libs/shared/auth/src/index.ts"], + "@kordis/shared/model": ["libs/shared/model/src/index.ts"], "@kordis/spa/auth": ["libs/spa/auth/src/index.ts"], "@kordis/spa/observability": ["libs/spa/observability/src/index.ts"] }