Search code examples
keycloakopenid-connectquarkus

How can i authenticate all the rest endpoint whithout specifying @authenticated annotation


I have auhenticated some of rest endpont using the OIDC @Authenticated annotation .

But some the rest are present in resources folder (Its is drools file) which not authenticated bydefault.

Is there any way to authenticate all rest endpoint which is coming form that location (Like .security constraints)

Here is my application.yaml file

`
quarkus:

  oidc:
    auth-server-url: '${AUTH_SERVER_URL}'
    client-id: '${CLIENT_ID}'
    application-type: service`

Solution

  • authenticated HTTP security policy can help, for example:

    quarkus.http.auth.permission.policy1.paths=/public/*,/services/*
    quarkus.http.auth.permission.policy1.policy=authenticated
    

    will do, see https://quarkus.io/guides/security-authorize-web-endpoints-reference