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

Aperta
#1,958 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Jennydou517 ci sta già lavorando.

Dal 21/11/2026.

  • #1976 di @Jennydou517 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
72/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
800
Fork
437
Merge medio
21h 36m
PR unite (30g)
167

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/wicket

Tutte le issue di apache/wicket

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.