quarkiverse / quarkus-renarde

Server-side Web Framework with Qute templating, magic/easier controllers, auth, reverse-routing
Apache License 2.0
78 stars 19 forks source link

Unsatisfied dependency for type io.quarkiverse.renarde.oidc.RenardeOidcHandler and qualifiers [@Default] #57

Closed tmulle closed 2 years ago

tmulle commented 2 years ago

We are trying to convert a legacy Play 2.x framework web application to run on Quarkus with minimal-changes to the existing code base.

So far it looks like Renamed is a VERY close fit to the Play framework in terms of Routing and template processing which we hope would make it easy to move over to Quarkus.

However, when setting up the user security I ran into an issue. We are NOT using OIDC and only a JDBC backend. Reading the Renarde Security page it looks like I need to import the OIDC dependency.

Doing so and setting up my User class to implement RenardeUser when I try to restart Quarkus I get the error below.

It seems that by making my UserProvider also implement the OIDC provider interface fixes the build issue, but it seems I shouldn't need to do this if just using JWT/Database?

I am using Quarkus 2.12.2.Final and

<dependency>
      <groupId>io.quarkiverse.renarde</groupId>
      <artifactId>quarkus-renarde-oidc</artifactId>
      <version>1.0.3</version>
    </dependency>

Thanks..

public class MyOidcSetup implements RenardeUserProvider,RenardeOidcHandler {

    @Inject
    RenardeSecurity security;

    @Override
    public RenardeUser findUser(String tenantId, String id) {
        return User.findByEmail(id);
    }

    @Override
    public void oidcSuccess(String tenantId, String authId) {
        // TODO Auto-generated method stub

    }

    @Override
    public void loginWithOidcSession(String tenantId, String authId) {
        // TODO Auto-generated method stub

    }
}
2022-09-18 10:00:43,657 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkiverse.renarde.oidc.RenardeOidcHandler and qualifiers [@Default]
        - java member: io.quarkiverse.renarde.oidc.impl.RenardeSecurityController#oidcHandler
        - declared on CLASS bean [types=[io.quarkiverse.renarde.oidc.impl.RenardeSecurityController, java.lang.Object, io.quarkiverse.renarde.Controller], qualifiers=[@Default, @Any], target=io.quarkiverse.renarde.oidc.impl.RenardeSecurityController]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1215)
FroMage commented 2 years ago

Huh, yeah, ok, this is an oversight, I should split OIDC away from this.