mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 04:16:30 +00:00
6429ad62c2
put model batch size as parameter in config
26 lines
797 B
C#
26 lines
797 B
C#
using Azaion.CommonSecurity.DTO;
|
|
using Azaion.CommonSecurity.DTO.Commands;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Azaion.CommonSecurity.Services;
|
|
|
|
public interface IAuthProvider
|
|
{
|
|
void Login(ApiCredentials credentials);
|
|
User CurrentUser { get; }
|
|
}
|
|
|
|
public class AuthProvider([FromKeyedServices(SecurityConstants.EXTERNAL_INFERENCE_PATH)] IExternalClient externalClient) : IAuthProvider
|
|
{
|
|
public User CurrentUser { get; private set; } = null!;
|
|
|
|
public void Login(ApiCredentials credentials)
|
|
{
|
|
externalClient.Send(RemoteCommand.Create(CommandType.Login, credentials));
|
|
var user = externalClient.Get<User>();
|
|
if (user == null)
|
|
throw new Exception("Can't get user from Auth provider");
|
|
|
|
CurrentUser = user;
|
|
}
|
|
} |