Skip to content

Feat/fees only - #1265

Open
mandresy753 wants to merge 18 commits into
hei-school:preprodfrom
mandresy753:feat/FeesOnly
Open

Feat/fees only#1265
mandresy753 wants to merge 18 commits into
hei-school:preprodfrom
mandresy753:feat/FeesOnly

Conversation

@mandresy753

@mandresy753 mandresy753 commented Jul 9, 2026

Copy link
Copy Markdown

Groupe 20 :

Description

  • This PR implements the feesOnly feature to restrict access to specific endpoints when the application runs in fees-only mode.

-The feature introduces access rules to allow fees-related operations, their required dependencies , and required public endpoints while blocking unrelated functionalities.

  • The initial implementation was based on an annotation and interceptor mechanism. Following the review feedback, the access control logic was moved to a centralized SecurityFilterChain configuration to make the rules more explicit and easier to maintain.

Changes

  • Added fees-only access control behavior
  • Defined allowed endpoints when feesOnly mode is enabled
  • Centralized fees-only security rules in SecurityFilterChain
  • Removed annotation-based interceptor implementation
  • Updated affected controllers and security configuration

Motivation

Provide a maintainable way to enable a restricted application mode where only fees-related features remain accessible.

Comment thread src/main/java/school/hei/haapi/endpoint/FeesOnlyInterceptor.java Outdated
Comment thread src/main/java/school/hei/haapi/endpoint/FeesOnlyInterceptor.java Outdated
Comment thread src/test/java/school/hei/haapi/FeesOnlyTrueIT.java Outdated

@DyferHerioss DyferHerioss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Create a filter chain in the security config instead of using an annotation, because a filter in a security config is more explicit than an annotation and easier to maintain.

@mandresy753
mandresy753 requested a review from DyferHerioss July 18, 2026 21:57
Comment on lines +24 to +29
@Order(1)
public SecurityFilterChain feesOnlyFilterChain(HttpSecurity http) throws Exception {
if (!feesOnly) {
http.securityMatcher(request -> false)
.authorizeHttpRequests(req -> req.anyRequest().denyAll());
return http.build();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why use order ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@Order(1) ensures this chain is evaluated first, so requests forbidden in feesOnly mode get blocked before the other chain (which accepts everything) can let them through.

Comment on lines +72 to 73
@Order(2)
public SecurityFilterChain configure(HttpSecurity httpSecurity) throws Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the same here, why you use order ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@order(2) ensures this chain is evaluated only after the feesOnly chain, so it only handles requests that aren't blocked by the feesOnly restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants