---
title: "Add JWT Authentication to Your Quarkus API"
description: "Secure your Quarkus API using JWT authentication with JWKS."
canonicalUrl: "https://zuplo.com/use-cases/api-key-auth/java/quarkus/jwt-backend"
framework: "Quarkus"
language: "Java"
authStrategy: "JWT with JWKS"
pageType: use-case
---

# Add JWT Authentication to Your Quarkus API

Secure your Quarkus API using JWT authentication with JWKS.

## How Zuplo Handles It

Let Zuplo issue short-lived JWTs signed with a JWKS your Quarkus backend can verify — no long-lived API keys touch your origin.

## Quarkus Backend Code

```java
// src/main/java/com/example/ProtectedResource.java
package com.example;

import io.quarkus.security.Authenticated;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.jwt.JsonWebToken;
import java.util.Map;

@Path("/protected")
@Authenticated
public class ProtectedResource {

    @Inject
    JsonWebToken jwt;

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getProtected() {
        return Response.ok(Map.of(
            "message", "Access granted",
            "sub", jwt.getSubject(),
            "issuer", jwt.getIssuer(),
            "claims", jwt.getClaimNames()
        )).build();
    }
}

// src/main/resources/application.properties
// mp.jwt.verify.publickey.location=https://my-api-a32f34.zuplo.api/__zuplo/issuer/.well-known/jwks.json
// mp.jwt.verify.issuer=https://my-api-a32f34.zuplo.api/__zuplo/issuer
// quarkus.smallrye-jwt.blocking-authentication=true
```

## Example Request

```bash
curl -X GET \
  'https://your-api.zuplo.dev/your-route' \
  -H 'Authorization: Bearer YOUR_API_KEY'
```

## Learn More

- [API Key Authentication on Zuplo](https://zuplo.com/docs/policies/api-key-auth-inbound)
- [JWT Authentication on Zuplo](https://zuplo.com/docs/policies/open-id-jwt-auth-inbound)
- [All use cases](https://zuplo.com/use-cases)
