quarkiverse / quarkus-langchain4j

Quarkus Langchain4j extension
https://docs.quarkiverse.io/quarkus-langchain4j/dev/index.html
Apache License 2.0
140 stars 83 forks source link

Add an OpenId Connect demo where a user is required to approve the `LLM` scope #81

Open sberyozkin opened 10 months ago

sberyozkin commented 10 months ago

I propose to demo and also recommend the following set up: a user logs in to a frontend Quarkus application (say Quarkus LLM) which talks to a microservice which uses the LLM, when the users logs in to the frontend the user is redirected to OIDC where the user will be asked to allow Quarkus LLM to apply for example Large Language Model to whatever Quarkus LLM is expected to solve/do. When the user approves and logs in to Quarkus LLM will propagate the access token to the microservice which will only be allowed to be accessed when such a token has an LLM scope/permission.

sberyozkin commented 10 months ago

This approach is about users having input into authorizing Quarkus to do some work for them with LLM, as far as the demo is concerned, it can be a copy and paste of https://quarkus.io/guides/security-oidc-auth0-tutorial#permission-based-access-control (with an LLM focused example), but I'll see if I can make it work with Keycloak first.

sberyozkin commented 10 months ago

There could be possibly one more pattern, where Quarkus acts similar to ChatGPT UI, and one of its plugins is registered in the openai platform, and requires an OAuth2 authentication:

https://platform.openai.com/docs/plugins/authentication/oauth, so the user would authenticate to Quarkus using OAuth2 (via the OpenAI platform) and that will enable an access token which will be used as an OpenAI key. I'm not sure yet if it can work with Quarkus at all, but just typing here in case it proves feasible