# application.properties - NO SECRETS HERE
# Use environment variables
quarkus.datasource.username=${DB_USER}
quarkus.datasource.password=${DB_PASSWORD}
quarkus.oidc.credentials.secret=${OIDC_CLIENT_SECRET}
# Or use Vault
quarkus.vault.url=https://vault.example.com
quarkus.vault.authentication.kubernetes.role=my-role
Security Note: Never use X-Forwarded-For directly — clients can spoof it.
Use the actual remote address from the servlet request, or an authenticated
identity (API key, JWT subject) when available.
java
@ApplicationScopedpublicclassRateLimitFilterimplementsContainerRequestFilter {
privatefinal Map<String, RateLimiter> limiters = newConcurrentHashMap<>();
@Inject
HttpServletRequest servletRequest;
@Overridepublicvoidfilter(ContainerRequestContext requestContext) {
StringclientId= getClientIdentifier();
RateLimiterlimiter= limiters.computeIfAbsent(clientId,
k -> RateLimiter.create(100.0)); // 100 requests per secondif (!limiter.tryAcquire()) {
requestContext.abortWith(
Response.status(429)
.entity(Map.of("error", "Too many requests"))
.build()
);
}
}
private String getClientIdentifier() {
// Use the container-provided remote address (not X-Forwarded-For).// If behind a trusted proxy, configure quarkus.http.proxy.proxy-address-forwarding=true// so getRemoteAddr() returns the real client IP.return servletRequest.getRemoteAddr();
}
}
Security Headers
java
@ProviderpublicclassSecurityHeadersFilterimplementsContainerResponseFilter {
@Overridepublicvoidfilter(ContainerRequestContext request, ContainerResponseContext response) {
MultivaluedMap<String, Object> headers = response.getHeaders();
// Prevent clickjacking
headers.putSingle("X-Frame-Options", "DENY");
// XSS protection
headers.putSingle("X-Content-Type-Options", "nosniff");
headers.putSingle("X-XSS-Protection", "1; mode=block");
// HSTS
headers.putSingle("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
// CSP — avoid 'unsafe-inline' for script-src as it negates XSS protection;// use nonces or hashes instead. 'unsafe-inline' for style-src is acceptable// when CSS frameworks require it, but prefer nonces where possible.
headers.putSingle("Content-Security-Policy",
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'");
}
}
Add this badge to a GitHub README so readers can open the package page and install the same version.
[](https://www.aipm-registry.com/skills/affaan-m/quarkus-security/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)
This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.
AI assistant context
What this skill is for
@affaan-m/quarkus-security@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: Quarkus security implementation patterns: JWT and OIDC authentication, @RolesAllowed RBAC and SecurityIdentity checks, Bean Validation and custom validators, parameterized Panache queries, BCrypt password hashing, CORS and security heade...
Preview a UI component mockup in a local browser canvas where the human directly edits it (move, resize, edit text, delete, restyle), switches mobile/desktop/custom viewports, tests it, chats with you, and clicks Save and Finish. You the...
Run aipm add @affaan-m/quarkus-security@1.0.0 in a project that has AIPM initialized.
Supported tools
@affaan-m/quarkus-security@1.0.0 supports All tools.
Before installing
AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.