All Known Implementing Classes:
JwtAuthAnnotationAnalyzer, RoleAnnotationAnalyzer

public interface AnnotationAnalyzer
Provides capability to extensions to enforce authentication and authorization even when the resource is not annotated with io.helidon.security.annotations.Authenticated or io.helidon.security.annotations.Authorized. This is loaded using a ServiceLoader - integration with Security is done automatically as long as the implementation is discovered as a java service.

Note: This type is no longer a FunctionalInterface, as we need to support both SE and MP types. We are refactoring our approach so we do not use reflection.

  • Method Details

    • init

      @Deprecated(since="4.4.0", forRemoval=true) default void init(Config config)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Provides configuration on node "security.jersey.analyzers".
      Parameters:
      config - config to use to configure an analyzer, may be empty (e.g. have reasonable defaults if possible)
    • init

      default void init(Config config)
      Provides configuration on node "security.jersey.analyzers".

      API Note: the default method implementation is provided for backward compatibility and will be removed in the next major version

      Parameters:
      config - config to use to configure an analyzer, may be empty (e.g. have reasonable defaults if possible)
      Since:
      4.4.0
    • supportsExpandedEndpointAnalysis

      default boolean supportsExpandedEndpointAnalysis()
      Whether this analyzer supports expanded callbacks for separate resource definition, declaring, and handling stages.

      The default preserves the original application, resource-class, and resource-method callback topology. The returned value must remain stable after initialization.

      Returns:
      true to opt in to expanded endpoint analysis
      Since:
      4.5.4
    • analyze

      @Deprecated(since="4.2.0") AnnotationAnalyzer.AnalyzerResponse analyze(Class<?> maybeAnnotated)
      Deprecated.
      this method will be made default in a future version, and marked for removal; it will be removed in two major versions from now (most likely version 6). Use analyze(io.helidon.common.types.TypeName, java.util.List) instead.
      Analyze an application class.
      Parameters:
      maybeAnnotated - class of the JAX-RS application
      Returns:
      response with information whether to (and how) authenticate and authorize
    • analyze

      default AnnotationAnalyzer.AnalyzerResponse analyze(TypeName applicationType, List<Annotation> annotations)
      Analyze application annotations.
      Parameters:
      applicationType - type to analyze
      annotations - annotations on the type
      Returns:
      response on how to authenticate and authorize
    • analyze

      @Deprecated(forRemoval=true, since="4.2.0") default AnnotationAnalyzer.AnalyzerResponse analyze(Class<?> maybeAnnotated, AnnotationAnalyzer.AnalyzerResponse previousResponse)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Analyze a resource class.

      An analyzer that opts in through supportsExpandedEndpointAnalysis() may receive several ordered class and method stages for resource definitions, declaring types, and concrete handlers. In that case, previousResponse is the response returned by this analyzer for the immediately preceding stage and may be a method-stage response.

      This legacy reflection callback receives the complete reflective class view and cannot represent a scoped or filtered annotation list. When called through the metadata callback's default implementation, filtering performed by the integration is therefore not visible. Integrations may omit legacy callbacks for stages that cannot be represented faithfully.

      Parameters:
      maybeAnnotated - class analyzed at this stage
      previousResponse - response from the preceding analyzer stage
      Returns:
      response describing authentication and authorization requirements
    • analyze

      default AnnotationAnalyzer.AnalyzerResponse analyze(TypeName endpointType, List<Annotation> annotations, AnnotationAnalyzer.AnalyzerResponse previousResponse)
      Analyze a resource type.

      By default, the supplied annotations are the complete annotation view of the selected resource class. An analyzer that opts in through supportsExpandedEndpointAnalysis() may receive several ordered callbacks for a resource's selected definition, method-declaring type, and concrete handling type. The supplied annotations are then exactly those selected for that stage and may be a declared, inherited, or filtered subset.

      Parameters:
      endpointType - type analyzed at this stage
      annotations - annotations selected for this stage
      previousResponse - response returned by this analyzer for the preceding class or method stage
      Returns:
      response describing authentication and authorization requirements
    • analyze

      @Deprecated(forRemoval=true, since="4.2.0") default AnnotationAnalyzer.AnalyzerResponse analyze(Method maybeAnnotated, AnnotationAnalyzer.AnalyzerResponse previousResponse)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Analyze a resource method.

      An analyzer that opts in through supportsExpandedEndpointAnalysis() may receive both Jersey's selected resource-definition method and the actual handling method. previousResponse is the response returned by this analyzer for the immediately preceding stage, normally the last applicable class stage.

      This legacy callback receives the complete reflective method view. The metadata callback's default implementation delegates here using its originating Method, when available, or a reflectively resolved matching method.

      Parameters:
      maybeAnnotated - method analyzed at this stage
      previousResponse - response from the preceding analyzer stage
      Returns:
      response describing authentication and authorization requirements
    • analyze

      Analyze a resource method.

      An analyzer that opts in through supportsExpandedEndpointAnalysis() may receive separate callbacks for a resource's selected definition method and actual handling method. The supplied metadata is the method view selected for this stage, and previousResponse is the response returned by this analyzer for the immediately preceding class or method stage.

      Parameters:
      typeName - declaring type of the method analyzed at this stage
      method - method metadata selected for this stage
      previousResponse - response from the preceding analyzer stage
      Returns:
      response describing authentication and authorization requirements