Skip to content

Conversation

@Breus
Copy link
Collaborator

@Breus Breus commented Oct 19, 2025

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements complete API key functionality, enabling users to generate API keys through the frontend and authenticate with them on the backend. The implementation replaces the previous mock/placeholder functionality with a full working system.

  • Replaces mock API key generation with real backend integration
  • Adds database support for storing API keys with unique constraints
  • Implements API key authentication filter for secure access

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/pages/Profile.tsx Replaces mock API key generation with real backend API call
backend/src/main/resources/db/migration/V3__add_api_key_column.sql Adds API key column and unique index to user_account table
backend/src/main/java/net/hackyourfuture/coursehub/web/model/ApiKeyResponse.java Creates response model for API key generation endpoint
backend/src/main/java/net/hackyourfuture/coursehub/web/UserAuthenticationController.java Adds POST endpoint for generating API keys
backend/src/main/java/net/hackyourfuture/coursehub/service/UserAuthenticationService.java Implements secure API key generation and user lookup by API key
backend/src/main/java/net/hackyourfuture/coursehub/security/ApiKeyAuthenticationFilter.java Creates authentication filter for API key-based requests
backend/src/main/java/net/hackyourfuture/coursehub/repository/UserAccountRepository.java Adds database methods for API key storage and retrieval
backend/src/main/java/net/hackyourfuture/coursehub/data/UserAccountEntity.java Updates entity to include API key field
backend/src/main/java/net/hackyourfuture/coursehub/SecurityConfig.java Integrates API key authentication filter into security chain

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Breus Breus force-pushed the api-key-generation-authentication branch from 11b0dce to e3aa5e8 Compare October 19, 2025 19:39
@Breus Breus requested a review from Copilot October 19, 2025 19:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

public class ApiKeyAuthenticationFilter extends OncePerRequestFilter {

private final UserAuthenticationService userAuthenticationService;
private static final String API_KEY_HEADER = "X-API-Key";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use standard Authorization: <api-key> header?

@Breus Breus merged commit 1e7f4f7 into main Oct 19, 2025
2 checks passed
@Breus Breus deleted the api-key-generation-authentication branch October 21, 2025 07:03
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.

3 participants