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.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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. }