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

Abierto
#1,958 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Jennydou517 ya está trabajando en esto.

Desde el 21/11/2026.

  • #1976 de @Jennydou517 — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
800
Forks
437
Merge medio
21 h 36 min
PR fusionados (30 d)
167

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/wicket

Todos los issues de apache/wicket

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.