Class JwtAuthCdiExtension

  • All Implemented Interfaces:
    jakarta.enterprise.inject.spi.Extension

    public class JwtAuthCdiExtension
    extends Object
    implements jakarta.enterprise.inject.spi.Extension
    This CDI extension installs the JWTAuthenticationMechanism and related SignedJWTIdentityStore when the LoginConfig annotation is encountered (MP-JWT 1.0 5).

    Additionally this extension checks that injection of claims are in the right scope (non-transitively, 7.1.3).

    Author:
    Arjan Tijms
    • Constructor Detail

      • JwtAuthCdiExtension

        public JwtAuthCdiExtension()
    • Method Detail

      • register

        public void register​(@Observes
                             jakarta.enterprise.inject.spi.BeforeBeanDiscovery beforeBean,
                             jakarta.enterprise.inject.spi.BeanManager beanManager)
      • findLoginConfigAnnotation

        public <T> void findLoginConfigAnnotation​(@Observes
                                                  jakarta.enterprise.inject.spi.ProcessBean<T> eventIn,
                                                  jakarta.enterprise.inject.spi.BeanManager beanManager)
        This method tries to find the LoginConfig annotation and if does flags that fact.
      • findRoles

        public <T> void findRoles​(@Observes
                                  jakarta.enterprise.inject.spi.ProcessManagedBean<T> eventIn,
                                  jakarta.enterprise.inject.spi.BeanManager beanManager)
        Find all the roles used by the @RolesAllowed annotation, so these can be programmatically declared later on.
      • checkInjectIntoRightScope

        public <T> void checkInjectIntoRightScope​(@Observes
                                                  jakarta.enterprise.inject.spi.ProcessInjectionTarget<T> eventIn,
                                                  jakarta.enterprise.inject.spi.BeanManager beanManager)
      • installMechanismIfNeeded

        public void installMechanismIfNeeded​(@Observes
                                             jakarta.enterprise.inject.spi.AfterBeanDiscovery eventIn,
                                             jakarta.enterprise.inject.spi.BeanManager beanManager)
      • isAddJWTAuthenticationMechanism

        public boolean isAddJWTAuthenticationMechanism()