up
This commit is contained in:
19
Services/ApiAuthorizationOptionsConfiguration.cs
Normal file
19
Services/ApiAuthorizationOptionsConfiguration.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace decePubClient.Services
|
||||
{
|
||||
public class ApiAuthorizationOptionsConfiguration : IPostConfigureOptions<RemoteAuthenticationOptions<ApiAuthorizationProviderOptions>>
|
||||
{
|
||||
public void Configure(RemoteAuthenticationOptions<ApiAuthorizationProviderOptions> options)
|
||||
{
|
||||
options.UserOptions.RoleClaim ??= "role";
|
||||
}
|
||||
|
||||
public void PostConfigure(string name, RemoteAuthenticationOptions<ApiAuthorizationProviderOptions> options)
|
||||
{
|
||||
if (string.Equals(name, Options.DefaultName))
|
||||
Configure(options);
|
||||
}
|
||||
}
|
||||
}
|
56
Services/CoalescingStringLocalizer.cs
Normal file
56
Services/CoalescingStringLocalizer.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using decePubClient.Resources;
|
||||
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
using SocialPub.ClientModels.Resources;
|
||||
|
||||
namespace collAnon.Client.Services
|
||||
{
|
||||
public sealed class CoalescingStringLocalizer
|
||||
{
|
||||
public readonly IStringLocalizer<AllStrings> _pLocalizer;
|
||||
readonly IStringLocalizer<FieldsNameResource> _fLocalizer;
|
||||
readonly IStringLocalizer<ErrorsResource> _eLocalizer;
|
||||
|
||||
public CoalescingStringLocalizer(
|
||||
IStringLocalizer<AllStrings> pLocalizer,
|
||||
IStringLocalizer<FieldsNameResource> fLocalizer,
|
||||
IStringLocalizer<ErrorsResource> eLocalizer) =>
|
||||
(_pLocalizer, _fLocalizer, _eLocalizer) =
|
||||
(pLocalizer, fLocalizer, eLocalizer);
|
||||
|
||||
internal LocalizedString this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_pLocalizer[name].ResourceNotFound)
|
||||
if (_fLocalizer[name].ResourceNotFound)
|
||||
if (_eLocalizer[name].ResourceNotFound)
|
||||
return new(name, name, false);
|
||||
else
|
||||
return _eLocalizer[name];
|
||||
else
|
||||
return _fLocalizer[name];
|
||||
else
|
||||
return _pLocalizer[name];
|
||||
}
|
||||
}
|
||||
|
||||
internal LocalizedString this[string name, params object[] arguments]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_pLocalizer[name].ResourceNotFound)
|
||||
if (_fLocalizer[name].ResourceNotFound)
|
||||
if (_eLocalizer[name].ResourceNotFound)
|
||||
return new(name, name, false);
|
||||
else
|
||||
return _eLocalizer[name, arguments];
|
||||
else
|
||||
return _fLocalizer[name, arguments];
|
||||
else
|
||||
return _pLocalizer[name, arguments];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +1,15 @@
|
||||
using Blazored.Modal.Services;
|
||||
using decePubClient.Models;
|
||||
using decePubClient.Models;
|
||||
using decePubClient.Models.Types;
|
||||
|
||||
namespace decePubClient.Services
|
||||
{
|
||||
public class MessagesService
|
||||
{
|
||||
readonly IModalService modalService;
|
||||
readonly IStorage storage;
|
||||
readonly HttpClient http;
|
||||
|
||||
public MessagesService(IHttpClientFactory clientFactory, IModalService modalService, IStorage storage)
|
||||
public MessagesService(IHttpClientFactory clientFactory, IStorage storage)
|
||||
{
|
||||
this.modalService = modalService;
|
||||
this.storage = storage;
|
||||
http = clientFactory.CreateClient("default");
|
||||
}
|
||||
|
Reference in New Issue
Block a user