Support meta-annotations for the wicket-auth-roles annotations

Đang mở
#1,958 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Jennydou517 đang làm issue này rồi.

Từ ngày 21/11/2026.

  • #1976 của @Jennydou517 — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
72/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend

Hướng nghiên cứu

Read AnnotationsRoleAuthorizationStrategy.java and its tests in AnnotationsRoleAuthorizationStrategyTest.java; first check the state of WICKET-7200, which may affect annotation resolution. Decide and test how meta-annotations interact with direct annotations, including whether lookup is recursive. Done means auth-roles annotations carried by a page or component class are honored and the tests cover the chosen behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

good first issue

Applications that protect many pages with the same roles repeat the same annotation everywhere:

@AuthorizeInstantiation({"roleA", "roleB", "roleC"})

Java lets you put that on your own annotation and use it instead:

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@AuthorizeInstantiation({"roleA", "roleB", "roleC"})
public @interface SomeFeatureAuthorization {}

but Wicket only looks for the annotation directly on the class, so the meta-annotation is ignored.

Where

wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/annotations/AnnotationsRoleAuthorizationStrategy.java, the element.getAnnotation(…) calls for AuthorizeInstantiation(s), AuthorizeAction(s) and AuthorizeResource.

Done when

  • An annotation that carries one of the auth-roles annotations is honoured on a page or component class. Decide whether one level of meta-annotation is enough, and what happens when the direct and the meta-annotation are both present.
  • Tests in wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authorization/strategies/role/annotations/AnnotationsRoleAuthorizationStrategyTest.java.
  • WICKET-7200 is changing how the same class resolves these annotations. Check its state before starting, to avoid conflicting changes.

Background

Originally requested as WICKET-6691. A committer supported the proposal.


Part of #1945. This issue is meant for a first contribution to Wicket. To work on it, leave a comment so others know; a claim without a pull request lapses after two weeks. Questions are welcome, here on the issue or on [email protected]. Start your branch from master, and see Send a pull request to Wicket for building and testing.

Ngôn ngữ chính
Java
Star
800
Fork
437
Merge trung bình
21 giờ 36 phút
Pull request đã merge (30 ngày)
167

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/wicket

Tất cả issue của apache/wicket

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.