What this layer provides
- Pluggable authentication modes
- Unified authorization model
- Stateless HTTP security
- Consistent API key error responses
Spring Middleware provides a unified security model for Spring Boot microservices. It builds on Spring Security and supports JWT, OIDC, API keys, and basic authentication, with explicit configuration of protected and public endpoints across services.
middleware:
security:
type: API_KEY
public-paths: []
protected-paths: []
Authentication is selected through middleware.security.type.
All security modes share the same path-based authorization rules.
protected-paths:
- type: ROLES
path: /api/**
methods: [ GET ]
allowed-roles: [ ADMIN ]
Request processing for API key authentication.
Typical API key setup.
middleware:
security:
type: API_KEY
public-paths:
- /swagger-ui/**
protected-paths:
- type: ROLES
path: /api/**
allowed-roles: [ ADMIN ]
api-key:
credentials:
- key: ${API_KEY}
roles: [ ADMIN ]