Security context
A security context is security-related configuration or execution state associated with a subject, request, container, or runtime environment.
Spring Security in Action, Second Edition
A security context is a Spring Security object that holds authentication information associated with the current execution or request.
- How it is used
- Retains authenticated-request data so controllers and authorization logic can use the current user and authorities.
- How deep it goes
- Defines the Authentication contract and explains thread-local, inheritable, and global management strategies, including asynchronous and concurrency hazards.
- Examples
- Uses controller access, an @Async username lookup, strategy configuration, and direct method-security tests with authenticated and unauthorized users.
- What you can do after
- Operate/configure it through SecurityContextHolder, retrieve authentication details, propagate them to asynchronous threads, and test secured methods.
Read how Spring Security in Action, Second Edition explains security context →
Kubernetes for Developers
A Kubernetes security context is a set of Pod or container settings that controls security-related execution properties such as the user identity.
- How it is used
- Configures elevated permissions for node-level work or restricts ordinary application containers to reduce risk.
- How deep it goes
- Shows concrete settings, startup failures, application fixes, and admission rejection diagnostics rather than an exhaustive security-context field reference.
- Examples
- Uses a privileged DaemonSet, a locked-down Pod, and a non-root service with port and file-permission failures.
- What you can do after
- Operate/configure a non-root workload and diagnose container startup or Pod admission failures.
Read how Kubernetes for Developers explains security context →
Quarkus in Action
A security context is information describing the authenticated principal and associated security state for a request or interaction.
- How it is used
- Connects authenticated request identity to REST-resource behavior such as ownership, filtering, and downstream service calls.
- How deep it goes
- Explains injection, principal lookup, anonymous handling, and filtering, but does not detail authentication-provider internals.
- Examples
- Demonstrates reservation creation, anonymous fallback, user ownership, and current-user reservation filtering.
- What you can do after
- Apply it via Jakarta REST injection to identify request users and enforce user-specific application behavior.
Google Anthos in Action
A Kubernetes security context is a pod or container specification field that controls identity, privilege, and filesystem security settings at runtime.
- How it is used
- Controls container identity and host-level privileges during Pod deployment.
- How deep it goes
- Defines user, group, filesystem-group, and privileged settings with runtime demonstrations, but defers cluster-wide enforcement to policy tools.
- Examples
- Uses busybox Pods, UID and group assignments, whoami and groups checks, and attempted host kernel changes.
- What you can do after
- Operate/configure Pods with nonroot identities and controlled privileges, then verify identity and host-operation behavior.
Read how Google Anthos in Action explains security context →
Also covered in
What to know first
- authorizationAuthorization is the determination of which actions or resources an identity or other entity is permitted to access under defined permissions or policies.
- authenticationAuthentication is the process of verifying the claimed identity of a user, service, device, or other entity.
- containerA software container is an isolated execution environment that packages an application and its dependencies, typically sharing the host operating-system kernel.
Related concepts
- authentication filterconfigured by · An authentication filter is a request-processing component that intercepts authentication requests and delegates them to an authentication mechanism.
- thread localuses · Thread-local data is data whose value or instance is independently associated with each executing thread.
- privileged containerconfigures · A privileged container is a container granted broad host-level permissions or capabilities that substantially reduce its normal isolation from the host.
- SecurityContextHolderused by · SecurityContextHolder is a Spring Security utility that provides access to the security context associated with the current execution.
- authenticationhas part · Authentication is the process of verifying the claimed identity of a user, service, device, or other entity.
Questions about security context
What is security context?
A security context is security-related configuration or execution state associated with a subject, request, container, or runtime environment.
Which Manning books explain security context?
Spring Security in Action, Second Edition, Kubernetes for Developers, Quarkus in Action and Google Anthos in Action.
What should I know before learning security context?
Manning books that teach security context usually introduce authorization, authentication and container first.
What are the parts of security context?
Security context includes authentication.
What is security context also called?
Security context is also called securityContext.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



