Cloud Native, Container First Java framework for building efficient Java applications with fast startup times and low memory usage
—
Quarkus provides comprehensive security framework with support for OIDC, JWT, RBAC, and integration with various authentication providers and security standards.
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface RolesAllowed {
String[] value();
}
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PermitAll {
}
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface DenyAll {
}Standard security annotations for method-level authorization.
public interface QuarkusSecurityIdentity extends SecurityIdentity {
Principal getPrincipal();
Set<String> getRoles();
<T> Attribute<T> getAttribute(String name);
boolean hasRole(String role);
boolean isAnonymous();
}Quarkus-specific security identity interface providing access to authentication and authorization information.
Usage Example:
@Path("/secure")
public class SecureResource {
@Inject
SecurityIdentity identity;
@GET
@RolesAllowed("user")
public String userEndpoint() {
return "Hello " + identity.getPrincipal().getName();
}
@GET
@Path("/admin")
@RolesAllowed("admin")
public String adminEndpoint() {
return "Admin access granted";
}
}Install with Tessl CLI
npx tessl i tessl/maven-io-quarkus--quarkus-bom