Back to Use Cases

Static SSR

The following sequence diagrams illustrate the use cases for Blazor.Auth in a Blazor application that is currently using Static SSR render mode.

For implementing these use-cases, an approach utilizing form submission is used. For more information on how Blazor handles form submission in Static SSR, refer to Blazor Documentation.

Sign-In

sequenceDiagram

actor user as User
participant page as SignIn Page

box rgba(101, 63, 232, 0.5) Blazor.Auth
participant userService as IUserService (Server)
end
participant authService as IAuthenticationService (Server)

user ->>+ page: Submit Sign-In Form

page ->>+ userService: SignInAsync(signInPayload)
note over user,userService: Call IUserService's `SignInAsync` method when handling sign-in form submission.

userService ->>+ authService: SignInAsync(signInPayload)
authService ->> authService: Your server-side sign-in logic

authService -->>- userService: AuthenticationResult

userService -->> userService: Update authentication cookies
userService -->>- page: AuthenticationResult

page -->>- user:  Form submission HTTP Response
note over user,userService: Updated cookies will be attached to the HTTP response <br/> which will result in them being automalically stored in the user's browser.

Sign-Up

sequenceDiagram

actor user as User
participant page as SignUp Page

box rgba(101, 63, 232, 0.5) Blazor.Auth
participant userService as IUserService (Server)
end
participant authService as IAuthenticationService (Server)

user ->>+ page: Submit Sign-Up Form

page ->>+ userService: SignUpAsync(signUpPayload)
note over user,userService: Call IUserService's `SignUpAsync` method when handling sign-up form submission.

userService ->>+ authService: SignUpAsync(signUpPayload)
authService ->> authService: Your server-side sign-up logic

authService -->>- userService: AuthenticationResult

userService -->> userService: Update authentication cookies
userService -->>- page: AuthenticationResult

page -->>- user:  Form submission HTTP Response
note over user,userService: Updated cookies will be attached to the HTTP response <br/> which will result in them being automalically stored in the user's browser.

Sign-Out

sequenceDiagram

actor user as User
participant page as Page

box rgba(101, 63, 232, 0.5) Blazor.Auth
participant userService as IUserService (Server)
end

user ->>+ page: Submit Sign-Out Form

page ->>+ userService: SignOutAsync()
note over user,userService: Call IUserService's `SignOutAsync` method when handling sign-out form submission.

userService -->> userService: Remove authentication cookies

userService -->>- page: 

page -->>- user:  Form submission HTTP Response
note over user,userService: Blazor.Auth will remove the user's authentication cookies <br/> by marking them as expired in the HTTP response.