Skip to content

Homework 6#5

Merged
async-human merged 7 commits intomainfrom
homework-6
Feb 1, 2026
Merged

Homework 6#5
async-human merged 7 commits intomainfrom
homework-6

Conversation

@async-human
Copy link
Copy Markdown
Owner

No description provided.

Introduces the core Identity and Access Management (IAM) service.

Defines `auth/v1/auth.proto` with the `IAMService` gRPC interface, including methods for user registration, login, session validation (`Whoami`), and user retrieval. Also includes related message structures like `RegisterRequest`, `LoginResponse`, `NotificationMethod`, and `ProviderName` enum.

Generates the corresponding Go Protobuf, gRPC, and validation code. Integrates the new `iam` module into the Go workspace.

Removes redundant `common/v1/session.proto`, `common/v1/user.proto`, and `user/v1/user.proto` definitions, consolidating authentication and user management under the new `auth/v1` schema.
- Refactors the IAM service into distinct gRPC services for authentication (Login, Whoami) and user management (Register, GetUser).
- Implements a comprehensive dependency injection (DI) container to manage application components such as PostgreSQL, Redis, repositories, and services.
- Integrates Redis for efficient session management, leveraging a new platform-level Redis client.
- Establishes a structured application lifecycle with graceful shutdown, centralized environment-based configuration, and a robust resource closing mechanism.
- Introduces common protobuf definitions for `User` and `NotificationMethod` under `pkg/proto/common/v1` for reusability across services.
- Updates PostgreSQL schema and migrations to include a `
Updates the gRPC service name from `AuthService` to `IAMService` for login and whoami operations within the integration tests. This change reflects a refactoring of the authentication service endpoint.
This commit applies consistent code formatting across the `iam` and `order` modules. Key changes include:

*   Reordering of import statements to maintain consistency.
*   Removal of `\ No newline at end of file` comments.
*   Minor whitespace and line-breaking adjustments for improved readability.
*   Simplified function parameter declarations (e.g., `param1, param2 string`).
*   Updates `order/go.mod` to reflect `goose/v3` as an indirect dependency.
Introduces authentication across services using a new IAM gRPC client and middleware.

The Inventory service's gRPC server now authenticates incoming requests by validating a `session-uuid` from gRPC metadata with the IAM service.

The Order service's HTTP API is updated to require an `X-Session-Uuid` header for all operations. A new HTTP middleware handles authentication by calling the IAM service and injecting user and session data into the request context. This session UUID is then forwarded to downstream gRPC calls, such as to the Inventory service, ensuring end-to-end session propagation.

API consistency is improved by renaming the `order_uuid` path parameter to `uuid` in the OpenAPI specification and generated code. New configuration variables are added to specify IAM gRPC service addresses for both Inventory and Order services.
Enhances robustness by explicitly handling errors during JSON (un)marshalling of user notification methods and session management. Previously ignored errors now result in default values being set, with a placeholder for future logging, preventing silent failures.

Reflects a protobuf field name change by updating `OrderUUID` to `UUID` in the `notification` service's order converter.

Includes minor import statement reordering across `inventory` and `order` services for code consistency.
@async-human async-human merged commit ca98d03 into main Feb 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant