in src/main/java/org/apache/geronimo/microprofile/impl/jwtauth/cdi/GeronimoJwtAuthExtension.java [93:127]
public void addClaimBeans(@Observes final AfterBeanDiscovery afterBeanDiscovery) {
// it is another instance than th eone used in our initializer but it should be backed by the same impl
afterBeanDiscovery.addBean()
.id(GeronimoJwtAuthExtension.class.getName() + "#" + GeronimoJwtAuthConfig.class.getName())
.beanClass(GeronimoJwtAuthConfig.class)
.types(GeronimoJwtAuthConfig.class, Object.class)
.qualifiers(Default.Literal.INSTANCE, Any.Literal.INSTANCE)
.scope(ApplicationScoped.class)
.createWith(ctx -> GeronimoJwtAuthConfig.create());
afterBeanDiscovery.addBean()
.id(GeronimoJwtAuthExtension.class.getName() + "#" + JsonWebToken.class.getName())
.beanClass(JsonWebToken.class)
.types(JsonWebToken.class, Object.class)
.qualifiers(Default.Literal.INSTANCE, Any.Literal.INSTANCE)
.scope(ApplicationScoped.class)
.createWith(ctx -> new ContextualJsonWebToken(() -> {
final TokenAccessor request = this.request.get();
if (request == null) {
throw new IllegalStateException("No JWT in this request");
}
return request.getToken();
}));
injectionPoints.forEach(injection ->
afterBeanDiscovery.addBean()
.id(GeronimoJwtAuthExtension.class.getName() + "#" + injection.getId())
.beanClass(injection.findClass())
.qualifiers(injection.literal(), Any.Literal.INSTANCE)
.scope(injection.findScope())
.types(injection.type, Object.class)
.createWith(ctx -> injection.createInstance(request.get())));
injectionPoints.clear();
}