Activity Diagram
Describe procedural workflows, swimlane partitions, object buffers, fork/join concurrency, and guarded control flows.
| 1 | dialect uml; |
| 2 | |
| 3 | uml::activity_diagram "User Authentication & MFA Verification" { |
| 4 | schema { |
| 5 | // Control nodes |
| 6 | control initial @Start; |
| 7 | control decision @CheckCredentials [label: "Credentials Valid?"]; |
| 8 | control decision @CheckMfaMethod [label: "MFA Enrolled?"]; |
| 9 | control decision @CheckTotp [label: "Code Valid?"]; |
| 10 | control merge @MergeFailure [label: "Failures"]; |
| 11 | control flow_final @AuthRejected; |
| 12 | control final @SessionCreated; |
| 13 | |
| 14 | // Actions |
| 15 | action @EnterCredentials [label: "Enter Username & Password"]; |
| 16 | action @VerifyCredentials [label: "Verify Password Hash"]; |
| 17 | action @SendPushChallenge [label: "Prompt Authenticator App"]; |
| 18 | action @VerifyTotpCode [label: "Verify Time-Based OTP"]; |
| 19 | action @IssueSessionToken [label: "Issue JWT & Establish Session"]; |
| 20 | action @LogFailedAttempt [label: "Log Security Failure"]; |
| 21 | } |
| 22 | |
| 23 | flow { |
| 24 | // Happy path and conditional branches |
| 25 | Start -> EnterCredentials; |
| 26 | EnterCredentials -> VerifyCredentials; |
| 27 | VerifyCredentials -> CheckCredentials; |
| 28 | |
| 29 | CheckCredentials { |
| 30 | if password.valid == true -> CheckMfaMethod; |
| 31 | else -> MergeFailure; |
| 32 | } |
| 33 | |
| 34 | CheckMfaMethod { |
| 35 | if user.mfa_enrolled == true -> SendPushChallenge; |
| 36 | else -> IssueSessionToken; |
| 37 | } |
| 38 | |
| 39 | SendPushChallenge -> VerifyTotpCode; |
| 40 | VerifyTotpCode -> CheckTotp; |
| 41 | |
| 42 | CheckTotp { |
| 43 | if totp.matches == true -> IssueSessionToken; |
| 44 | else -> MergeFailure; |
| 45 | } |
| 46 | |
| 47 | MergeFailure -> LogFailedAttempt; |
| 48 | LogFailedAttempt -> AuthRejected; |
| 49 | |
| 50 | IssueSessionToken -> SessionCreated; |
| 51 | } |
| 52 | |
| 53 | layout { |
| 54 | reference AuthSpine: column [gap: 40, align: center] { |
| 55 | control @Start |
| 56 | action @EnterCredentials |
| 57 | action @VerifyCredentials |
| 58 | control @CheckCredentials |
| 59 | control @CheckMfaMethod |
| 60 | action @SendPushChallenge |
| 61 | action @VerifyTotpCode |
| 62 | control @CheckTotp |
| 63 | action @IssueSessionToken |
| 64 | control @SessionCreated |
| 65 | } |
| 66 | |
| 67 | branch FailureSpine: column [gap: 40, align: center] { |
| 68 | control @MergeFailure |
| 69 | action @LogFailedAttempt |
| 70 | control @AuthRejected |
| 71 | } |
| 72 | |
| 73 | joint FailureJoint: row [gap: 240, align: middle] { |
| 74 | control @CheckTotp |
| 75 | control @MergeFailure |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | theme { |
| 80 | action: [fill: "#1e1e2e", border: [color: "#89b4fa", radius: 8]]; |
| 81 | control decision: [fill: "#f9e2af", border: [color: "#fab387"]]; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | |
Errors: 0 | activity-diagram
Core Syntax Reference
| Construct | Purpose |
|---|---|
control initial|decision|merge|final @Id; | Declare UML activity control nodes |
action @Id [label: "..."]; | Declare executable activity steps |
frame partition @Lane { ... } | Group actions into swimlane partitions |
A -> B if "[guard]"; | Guarded control flow edge |