<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1" -->

---
title: Secure-by-Default Spring Apps: Zero Trust, OAuth2, and...
description: A conference talk presents a secure-by-default architecture for Spring applications built on zero trust principles, moving away from perimeter-based intranet...
canonical: https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Secure-by-Default Spring Apps: Zero Trust, OAuth2, and Runtime Policies by Ivan Šarić @ Spring I/O | daily.dev
og:description: A conference talk presents a secure-by-default architecture for Spring applications built on zero trust principles, moving away from perimeter-based intranet...
og:url: https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1
og:image: https://api.daily.dev/og/posts/tmH1NWbv1.png
og:image:alt: Secure-by-Default Spring Apps: Zero Trust, OAuth2, and Runtime Policies by Ivan Šarić @ Spring I/O
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Secure-by-Default Spring Apps: Zero Trust, OAuth2, and Runtime Policies by Ivan Šarić @ Spring I/O

**[Spring I/O](https://daily.dev/sources/springio)** · 31 min read · 0 upvotes · 0 comments

## Summary

A conference talk presents a secure-by-default architecture for Spring applications built on zero trust principles, moving away from perimeter-based intranet security toward workload-level trust. It covers three pillars: identity via Spring Authorization Server and JWT/opaque token trade-offs, workload trust using SPIFFE/SPIRE for mTLS certificate rotation and RFC 8705 certificate-bound access tokens plus DPoP (RFC 9449) for front-end clients, and runtime policy enforcement using Open Policy Agent (OPA) with Rego policy-as-code deployed as a sidecar. The talk closes with a migration checklist (stop using static API keys, adopt SPIFFE/SPIRE SVIDs, implement certificate-bound tokens, decouple authorization with OPA, integrate policy evaluation into CI/CD and observability) and a Q&A where the speaker notes Revolut doesn't use Spring but follows similar architectural principles via custom tooling.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=M_WpViL-_cI>

## Questions this post answers

### How does certificate-bound access tokens (RFC 8705) prevent JWT replay attacks?

A client's mTLS certificate SHA-256 thumbprint is embedded as a claim in its JWT when the token is issued. The receiving service extracts the actual certificate thumbprint from the mutual TLS handshake and compares it against the claim; if they don't match, the token is rejected regardless of valid signatures. This means an intercepted token cannot be replayed from a different client because it lacks the matching certificate.

_Teams hardening OAuth2 flows against token replay can find related security architecture writeups on daily.dev._

### What is the difference between using SPIFFE/SPIRE with mTLS versus DPoP for securing service-to-service and client requests?

SPIFFE/SPIRE issues short-lived SVID certificates rotated automatically via a SPIRE agent sidecar, enabling mTLS between backend services without downtime. DPoP (RFC 9449) serves as a front-end counterpart where the client itself generates and registers its own certificate pair with the authorization server, adding CPU overhead on the client but remaining cheaper than opaque reference tokens for high-security environments.

_Developers comparing workload identity approaches can track these authentication patterns on daily.dev._

### Why would a large distributed corporation choose opaque reference tokens over JWTs for authentication?

Opaque reference tokens can be revoked instantly from a centralized authentication server, unlike self-contained JWTs which are cheap to validate but hard to revoke and vulnerable to replay attacks without added protections. The trade-off is performance cost, since every request requires verification against the auth server, making opaque tokens unsuitable for public-facing frontends unless security requirements are especially strict.

_Engineers weighing token strategies for zero trust systems can follow these trade-off discussions on daily.dev._

## Similar posts on daily.dev

- [Trust Beyond Containers: Identity and Agent Security Lessons from KubeCon 2025](https://daily.dev/posts/trust-beyond-containers-identity-and-agent-security-lessons-from-kubecon-2025-zkkfv36dx) · Security Boulevard · 0 upvotes · 0 comments
- [Hardening browser security with zero-trust controls](https://daily.dev/posts/hardening-browser-security-with-zero-trust-controls-dencxr7k7) · CSO Online · 0 upvotes · 0 comments
- [Zero trust Kubernetes: Context over credentials](https://daily.dev/posts/zero-trust-kubernetes-context-over-credentials-f1wy7ifpv) · All Things Open · 1 upvotes · 0 comments
- [Zero Trust Isn't a Checkbox](https://daily.dev/posts/zero-trust-isn-t-a-checkbox-lqheyyklp) · SingleStore · 1 upvotes · 0 comments

---

Tags: [#spring-security](https://daily.dev/tags/spring-security)

[View this post on daily.dev](https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Secure-by-Default Spring Apps: Zero Trust, OAuth2, and Runtime Policies by Ivan Šarić @ Spring I/O","url":"https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1"},"datePublished":"2026-09-27T07:26:34.657Z","dateModified":"2026-09-27T07:34:34.326Z","description":"A conference talk presents a secure-by-default architecture for Spring applications built on zero trust principles, moving away from perimeter-based intranet...","image":"https://i.ytimg.com/vi/M_WpViL-_cI/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/M_WpViL-_cI/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Spring I/O","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Spring I/O","logo":"https://media.daily.dev/image/upload/s--e-TcwM9B--/f_auto,q_auto/v1790493985/logos/springio?_a=BAMAMicg0","url":"https://daily.dev/sources/springio"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"spring-security","timeRequired":"PT31M","video":{"@type":"VideoObject","name":"Secure-by-Default Spring Apps: Zero Trust, OAuth2, and Runtime Policies by Ivan Šarić @ Spring I/O","description":"A conference talk presents a secure-by-default architecture for Spring applications built on zero trust principles, moving away from perimeter-based intranet...","thumbnailUrl":"https://i.ytimg.com/vi/M_WpViL-_cI/sddefault.jpg","uploadDate":"2026-09-27T07:26:34.657Z","duration":"PT31M","url":"https://api.daily.dev/r/tmH1NWbv1","embedUrl":"https://www.youtube.com/embed/M_WpViL-_cI"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Spring I/O","item":"https://daily.dev/sources/springio"},{"@type":"ListItem","position":3,"name":"Secure-by-Default Spring Apps: Zero Trust, OAuth2, and Runtime Policies by Ivan Šarić @ Spring I/O"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/secure-by-default-spring-apps-zero-trust-oauth2-and-runtime-policies-by-ivan-ari-spring-i-o-tmh1nwbv1#faq","mainEntity":[{"@type":"Question","name":"How does certificate-bound access tokens (RFC 8705) prevent JWT replay attacks?","acceptedAnswer":{"@type":"Answer","text":"A client's mTLS certificate SHA-256 thumbprint is embedded as a claim in its JWT when the token is issued. The receiving service extracts the actual certificate thumbprint from the mutual TLS handshake and compares it against the claim; if they don't match, the token is rejected regardless of valid signatures. This means an intercepted token cannot be replayed from a different client because it lacks the matching certificate. Teams hardening OAuth2 flows against token replay can find related security architecture writeups on daily.dev."}},{"@type":"Question","name":"What is the difference between using SPIFFE/SPIRE with mTLS versus DPoP for securing service-to-service and client requests?","acceptedAnswer":{"@type":"Answer","text":"SPIFFE/SPIRE issues short-lived SVID certificates rotated automatically via a SPIRE agent sidecar, enabling mTLS between backend services without downtime. DPoP (RFC 9449) serves as a front-end counterpart where the client itself generates and registers its own certificate pair with the authorization server, adding CPU overhead on the client but remaining cheaper than opaque reference tokens for high-security environments. Developers comparing workload identity approaches can track these authentication patterns on daily.dev."}},{"@type":"Question","name":"Why would a large distributed corporation choose opaque reference tokens over JWTs for authentication?","acceptedAnswer":{"@type":"Answer","text":"Opaque reference tokens can be revoked instantly from a centralized authentication server, unlike self-contained JWTs which are cheap to validate but hard to revoke and vulnerable to replay attacks without added protections. The trade-off is performance cost, since every request requires verification against the auth server, making opaque tokens unsuitable for public-facing frontends unless security requirements are especially strict. Engineers weighing token strategies for zero trust systems can follow these trade-off discussions on daily.dev."}}]}
```

