Blazor & WASM in combination to get statistics from Spotify API for performing the song analysis. With separate microservices for auth, Spotify, user data tracking, and application, connected through gRPC with Polly.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

AuthProvider.cs 794B

1234567891011121314151617181920212223242526
  1. using Blazored.SessionStorage;
  2. using System.Security.Claims;
  3. namespace NemAnBlazor
  4. {
  5. public class AuthProvider : AuthenticationStateProvider
  6. {
  7. private readonly ISessionStorageService _sessionStorage;
  8. public AuthProvider(ISessionStorageService sessionStorage)
  9. {
  10. _sessionStorage = sessionStorage;
  11. }
  12. public override async Task<AuthenticationState> GetAuthenticationStateAsync()
  13. {
  14. string token = await _sessionStorage.GetItemAsync<string>("token");
  15. ClaimsIdentity identity = new ();
  16. ClaimsPrincipal user = new (identity);
  17. AuthenticationState state = new(user);
  18. NotifyAuthenticationStateChanged(Task.FromResult(state));
  19. return state;
  20. }
  21. }
  22. }