diff --git a/toju-app/src/app/app.routes.ts b/toju-app/src/app/app.routes.ts index e4640ce..51dadc7 100644 --- a/toju-app/src/app/app.routes.ts +++ b/toju-app/src/app/app.routes.ts @@ -10,12 +10,12 @@ export const routes: Routes = [ { path: 'login', loadComponent: () => - import('./domains/auth/feature/login/login.component').then((module) => module.LoginComponent) + import('./domains/authentication/feature/login/login.component').then((module) => module.LoginComponent) }, { path: 'register', loadComponent: () => - import('./domains/auth/feature/register/register.component').then((module) => module.RegisterComponent) + import('./domains/authentication/feature/register/register.component').then((module) => module.RegisterComponent) }, { path: 'invite/:inviteId', diff --git a/toju-app/src/app/domains/README.md b/toju-app/src/app/domains/README.md index caca01e..f07dfa5 100644 --- a/toju-app/src/app/domains/README.md +++ b/toju-app/src/app/domains/README.md @@ -10,7 +10,7 @@ infrastructure adapters and UI. | -------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | | **attachment** | File upload/download, chunk transfer, persistence | `AttachmentFacade` | | **access-control** | Role, permission, ban matching, moderation, and room access rules | `normalizeRoomAccessControl()`, `resolveRoomPermission()`, `hasRoomBanForUser()` | -| **auth** | Login / register HTTP orchestration, user-bar UI | `AuthService` | +| **authentication** | Login / register HTTP orchestration, user-bar UI | `AuthenticationService` | | **chat** | Messaging rules, sync logic, GIF/Klipy integration, chat UI | `KlipyService`, `canEditMessage()`, `ChatMessagesComponent` | | **notifications** | Notification preferences, unread tracking, desktop alert orchestration | `NotificationsFacade` | | **screen-share** | Source picker, quality presets | `ScreenShareFacade` | @@ -25,7 +25,7 @@ The larger domains also keep longer design notes in their own folders: - [attachment/README.md](attachment/README.md) - [access-control/README.md](access-control/README.md) -- [auth/README.md](auth/README.md) +- [authentication/README.md](authentication/README.md) - [chat/README.md](chat/README.md) - [notifications/README.md](notifications/README.md) - [screen-share/README.md](screen-share/README.md) diff --git a/toju-app/src/app/domains/auth/index.ts b/toju-app/src/app/domains/auth/index.ts deleted file mode 100644 index b56289d..0000000 --- a/toju-app/src/app/domains/auth/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './application/auth.service'; diff --git a/toju-app/src/app/domains/auth/README.md b/toju-app/src/app/domains/authentication/README.md similarity index 75% rename from toju-app/src/app/domains/auth/README.md rename to toju-app/src/app/domains/authentication/README.md index 04d1708..d65c5f5 100644 --- a/toju-app/src/app/domains/auth/README.md +++ b/toju-app/src/app/domains/authentication/README.md @@ -1,13 +1,16 @@ -# Auth Domain +# Authentication Domain Handles user authentication (login and registration) against the configured server endpoint. Provides the login, register, and user-bar UI components. ## Module map ``` -auth/ +authentication/ ├── application/ -│ └── auth.service.ts HTTP login/register against the active server endpoint +│ └── authentication.service.ts HTTP login/register against the active server endpoint +│ +├── domain/ +│ └── authentication.model.ts LoginResponse interface │ ├── feature/ │ ├── login/ Login form component @@ -19,14 +22,14 @@ auth/ ## Service overview -`AuthService` resolves the API base URL from `ServerDirectoryFacade`, then makes POST requests for login and registration. It does not hold session state itself; after a successful login the calling component stores `currentUserId` in localStorage and dispatches `UsersActions.setCurrentUser` into the NgRx store. +`AuthenticationService` resolves the API base URL from `ServerDirectoryFacade`, then makes POST requests for login and registration. It does not hold session state itself; after a successful login the calling component stores `currentUserId` in localStorage and dispatches `UsersActions.setCurrentUser` into the NgRx store. ```mermaid graph TD Login[LoginComponent] Register[RegisterComponent] UserBar[UserBarComponent] - Auth[AuthService] + Auth[AuthenticationService] SD[ServerDirectoryFacade] Store[NgRx Store] @@ -36,7 +39,7 @@ graph TD Auth --> SD Login --> Store - click Auth "application/auth.service.ts" "HTTP login/register" _blank + click Auth "application/authentication.service.ts" "HTTP login/register" _blank click Login "feature/login/" "Login form" _blank click Register "feature/register/" "Registration form" _blank click UserBar "feature/user-bar/" "Current user display" _blank @@ -49,7 +52,7 @@ graph TD sequenceDiagram participant User participant Login as LoginComponent - participant Auth as AuthService + participant Auth as AuthenticationService participant SD as ServerDirectoryFacade participant API as Server API participant Store as NgRx Store diff --git a/toju-app/src/app/domains/auth/application/auth.service.ts b/toju-app/src/app/domains/authentication/application/authentication.service.ts similarity index 90% rename from toju-app/src/app/domains/auth/application/auth.service.ts rename to toju-app/src/app/domains/authentication/application/authentication.service.ts index 3cbcc1d..e930632 100644 --- a/toju-app/src/app/domains/auth/application/auth.service.ts +++ b/toju-app/src/app/domains/authentication/application/authentication.service.ts @@ -3,18 +3,7 @@ import { Injectable, inject } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { type ServerEndpoint, ServerDirectoryFacade } from '../../server-directory'; - -/** - * Response returned by the authentication endpoints (login / register). - */ -export interface LoginResponse { - /** Unique user identifier assigned by the server. */ - id: string; - /** Login username. */ - username: string; - /** Human-readable display name. */ - displayName: string; -} +import type { LoginResponse } from '../domain/authentication.model'; /** * Handles user authentication (login and registration) against a @@ -25,7 +14,7 @@ export interface LoginResponse { * server endpoint is used. */ @Injectable({ providedIn: 'root' }) -export class AuthService { +export class AuthenticationService { private readonly http = inject(HttpClient); private readonly serverDirectory = inject(ServerDirectoryFacade); diff --git a/toju-app/src/app/domains/authentication/domain/authentication.model.ts b/toju-app/src/app/domains/authentication/domain/authentication.model.ts new file mode 100644 index 0000000..647dd74 --- /dev/null +++ b/toju-app/src/app/domains/authentication/domain/authentication.model.ts @@ -0,0 +1,11 @@ +/** + * Response returned by the authentication endpoints (login / register). + */ +export interface LoginResponse { + /** Unique user identifier assigned by the server. */ + id: string; + /** Login username. */ + username: string; + /** Human-readable display name. */ + displayName: string; +} diff --git a/toju-app/src/app/domains/auth/feature/login/login.component.html b/toju-app/src/app/domains/authentication/feature/login/login.component.html similarity index 100% rename from toju-app/src/app/domains/auth/feature/login/login.component.html rename to toju-app/src/app/domains/authentication/feature/login/login.component.html diff --git a/toju-app/src/app/domains/auth/feature/login/login.component.ts b/toju-app/src/app/domains/authentication/feature/login/login.component.ts similarity index 95% rename from toju-app/src/app/domains/auth/feature/login/login.component.ts rename to toju-app/src/app/domains/authentication/feature/login/login.component.ts index e7f2d87..d99fa8f 100644 --- a/toju-app/src/app/domains/auth/feature/login/login.component.ts +++ b/toju-app/src/app/domains/authentication/feature/login/login.component.ts @@ -11,7 +11,7 @@ import { Store } from '@ngrx/store'; import { NgIcon, provideIcons } from '@ng-icons/core'; import { lucideLogIn } from '@ng-icons/lucide'; -import { AuthService } from '../../application/auth.service'; +import { AuthenticationService } from '../../application/authentication.service'; import { ServerDirectoryFacade } from '../../../server-directory'; import { UsersActions } from '../../../../store/users/users.actions'; import { User } from '../../../../shared-kernel'; @@ -40,7 +40,7 @@ export class LoginComponent { serverId: string | undefined = this.serversSvc.activeServer()?.id; error = signal(null); - private auth = inject(AuthService); + private auth = inject(AuthenticationService); private store = inject(Store); private route = inject(ActivatedRoute); private router = inject(Router); diff --git a/toju-app/src/app/domains/auth/feature/register/register.component.html b/toju-app/src/app/domains/authentication/feature/register/register.component.html similarity index 100% rename from toju-app/src/app/domains/auth/feature/register/register.component.html rename to toju-app/src/app/domains/authentication/feature/register/register.component.html diff --git a/toju-app/src/app/domains/auth/feature/register/register.component.ts b/toju-app/src/app/domains/authentication/feature/register/register.component.ts similarity index 95% rename from toju-app/src/app/domains/auth/feature/register/register.component.ts rename to toju-app/src/app/domains/authentication/feature/register/register.component.ts index 6b6a8f9..0514541 100644 --- a/toju-app/src/app/domains/auth/feature/register/register.component.ts +++ b/toju-app/src/app/domains/authentication/feature/register/register.component.ts @@ -11,7 +11,7 @@ import { Store } from '@ngrx/store'; import { NgIcon, provideIcons } from '@ng-icons/core'; import { lucideUserPlus } from '@ng-icons/lucide'; -import { AuthService } from '../../application/auth.service'; +import { AuthenticationService } from '../../application/authentication.service'; import { ServerDirectoryFacade } from '../../../server-directory'; import { UsersActions } from '../../../../store/users/users.actions'; import { User } from '../../../../shared-kernel'; @@ -41,7 +41,7 @@ export class RegisterComponent { serverId: string | undefined = this.serversSvc.activeServer()?.id; error = signal(null); - private auth = inject(AuthService); + private auth = inject(AuthenticationService); private store = inject(Store); private route = inject(ActivatedRoute); private router = inject(Router); diff --git a/toju-app/src/app/domains/auth/feature/user-bar/user-bar.component.html b/toju-app/src/app/domains/authentication/feature/user-bar/user-bar.component.html similarity index 100% rename from toju-app/src/app/domains/auth/feature/user-bar/user-bar.component.html rename to toju-app/src/app/domains/authentication/feature/user-bar/user-bar.component.html diff --git a/toju-app/src/app/domains/auth/feature/user-bar/user-bar.component.ts b/toju-app/src/app/domains/authentication/feature/user-bar/user-bar.component.ts similarity index 100% rename from toju-app/src/app/domains/auth/feature/user-bar/user-bar.component.ts rename to toju-app/src/app/domains/authentication/feature/user-bar/user-bar.component.ts diff --git a/toju-app/src/app/domains/authentication/index.ts b/toju-app/src/app/domains/authentication/index.ts new file mode 100644 index 0000000..26a4a8a --- /dev/null +++ b/toju-app/src/app/domains/authentication/index.ts @@ -0,0 +1,2 @@ +export * from './application/authentication.service'; +export * from './domain/authentication.model';