Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use quarkus security with quarkus-smallrye-graphql?

I am trying to use the quarkus-smallrye-graphql extension. And it seems like I cannot use any of the security annotations such as @Authenticated in a class annotated with @GraphQLApi. I previously tried to use the smallrye-graphql project directly and I was able to use security. But now when using the offered extension in quarkus, it does not work.

A simple example of api class is

@GraphQLApi
public class SomeApi {
    @Query
    @Authenticated
    public String testQuery() {
        return "hello...";
    }
}

This does not work with the extension and I always get the unauthorized exception. Does anyone know how to do this?

like image 786
user3331860 Avatar asked Oct 16 '22 02:10

user3331860


People also ask

Is GraphQL introspection a vulnerability?

GraphQL introspection is primarily for GraphQL developer tooling. Leaving introspection on in production exposes potential issues like exposing sensitive information and enables malicious parties to more easily discover graph vulnerabilities.

What is spring GraphQL?

Spring for GraphQL is the successor of the GraphQL Java Spring project from the GraphQL Java team. It aims to be the foundation for all Spring, GraphQL applications. The project reached version 1.0 in May 2022. Please, use our issue tracker to report a problem, discuss a design issue, or to request a feature.


1 Answers

The extension is not properly integrated with programmatic security yet. Please follow https://github.com/quarkusio/quarkus/issues/10001 that I've reported, it should be fixed soon.

In the meantime, it is possible to use config-based security as described in https://quarkus.io/guides/security#authorization-of-web-endpoints-using-configuration, just use /graphql* for the quarkus.http.auth.permission.roles1.paths property

like image 179
Jan Martiška Avatar answered Oct 21 '22 02:10

Jan Martiška