leangen / graphql-spqr-spring-boot-starter

Spring Boot 2 starter powered by GraphQL SPQR
Apache License 2.0
275 stars 68 forks source link

Error with Spring Security #111

Open joramkimata opened 3 years ago

joramkimata commented 3 years ago

Hello there!

Am getting the following error

Exception while fetching data (/getAllUsers) : An Authentication object was not found in the SecurityContext

Here is my code

@GraphQLQuery(name = "getAllUsers")
    @PreAuthorize("hasRole('ROLE_USERS')")
    @PermissionMetaData(description = "Can view users", groupName = "UAA", moduleName = Constants.USERS_MANAGEMENT)
    public List<User> getAllUsers() {
        return this.userService.getAllUsers();
    }