1
0

Split into per-article modules and add the method-security module

Moves the existing virtual-thread/context-propagation project into
context-propagation/ and adds method-security/ for the Spring Security 7
method-security article: nine runnable demos, fourteen assertions, and every
transcript the article quotes, regenerated by scripts/run-all.sh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSrsDSRKVsY588yFiMJMo9
This commit is contained in:
2026-08-25 02:01:29 +00:00
parent 9f950bffa9
commit 5e9e7f1b12
65 changed files with 4088 additions and 119 deletions

View File

@@ -0,0 +1,51 @@
package com.ankurm.methodsec;
/**
* The one domain object every demo in this module operates on.
*
* <p>{@code owner} is deliberately a plain {@code String} that matches
* {@code authentication.getName()}, because that is what makes expressions like
* {@code returnObject.owner == authentication.name} readable in the SpEL reference
* (<a href="../../../../../../docs/02-spel-reference.md">docs/02-spel-reference.md</a>).
*
* <p>Not a record: {@link Demo7DeniedHandling} needs a CGLIB-proxyable, non-final class for
* {@code @AuthorizeReturnObject}, and records are final. That restriction is itself one of the
* findings -- see
* <a href="../../../../../../docs/06-denied-handling.md">docs/06-denied-handling.md</a>.
*/
public class Account {
private final long id;
private final String owner;
private long balanceMinor;
public Account(long id, String owner, long balanceMinor) {
this.id = id;
this.owner = owner;
this.balanceMinor = balanceMinor;
}
public long getId() {
return this.id;
}
public String getOwner() {
return this.owner;
}
public long getBalanceMinor() {
return this.balanceMinor;
}
public void setBalanceMinor(long balanceMinor) {
this.balanceMinor = balanceMinor;
}
@Override
public String toString() {
return "Account[" + this.id + "," + this.owner + "," + this.balanceMinor + "]";
}
}