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 the purposes of these sample flows, an approach utilizing form submission is used. For more information on how Blazor handles form submission in Static SSR, refer to Blazor Documentation. You can use any other approach, as long as it is compatible with Static SSR. Just resolve the IUserService from the DI container and call it's appropriate method - Blazor.Auth will take care of the rest.

Sign-In

sequenceDiagram

actor user as User
participant page as 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: AuthenticationOperationInfo

page -->>- user:  Form submission HTTP Response
note over user,page: Updated cookies will be <br/> attached to the HTTP response.

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: Clear authentication cookies

userService -->>- page: 

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

Sign-Up

sequenceDiagram

actor user as User
participant page as 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,page: Updated cookies will be<br/>attached to the HTTP response.