# direction: down vars { d2-config { sketch: true center: true } } Start: "User clicks\n\"Sign in with Microsoft\"" { style.fill: "#e3f2fd" } MicrosoftAuth: "Microsoft Identity Platform\nOAuth Authentication\n(login.microsoftonline.com/common)" { style.fill: "#e3f2fd" } Handler: "MicrosoftAuthRegistrationHandler\n.createUser() called" { style.fill: "#fff3e0" } ResolveEmail: "Resolve email:\nprefer data.email,\nfallback to data.username (UPN)" { style.fill: "#fff3e0" } QueryUser: "Query User by\nUsername = email + '.smi'" { style.fill: "#fff3e0" } Decision: "User found?" { shape: diamond style.fill: "#f3e5f5" } Success: "Return User\n(login successful)" { style.fill: "#e8f5e9" } Error: "Throw exception\nwith guidance" { style.fill: "#ffebee" } ErrorMessage: "User sees error message" { style.fill: "#ffebee" } DonorboxLink: "Donorbox signup link\n(new members)" { style.fill: "#fff9c4" } WebdevContact: "webdev contact info\n(existing members)" { style.fill: "#fff9c4" } Start -> MicrosoftAuth MicrosoftAuth -> Handler Handler -> ResolveEmail ResolveEmail -> QueryUser QueryUser -> Decision Decision -> Success: yes Decision -> Error: no Error -> ErrorMessage ErrorMessage -> DonorboxLink ErrorMessage -> WebdevContact