Add boilerplate Auth server
This commit is contained in:
parent
24654a32df
commit
864ed2ceb1
1 changed files with 52 additions and 0 deletions
52
Server/AuthorizationServer.cs
Normal file
52
Server/AuthorizationServer.cs
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ReInject.Implementation.Attributes;
|
||||||
|
|
||||||
|
namespace Server;
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
|
public class AuthorizationServer : NetCoreServer.TcpServer
|
||||||
|
{
|
||||||
|
[Inject] private readonly Microsoft.Extensions.Logging.ILogger _logger;
|
||||||
|
|
||||||
|
public AuthorizationServer(IConfiguration configuration, ILoggerFactory loggerFactory) : base(
|
||||||
|
configuration["auth:address"]!,
|
||||||
|
configuration.GetValue<int>("auth:port"))
|
||||||
|
{
|
||||||
|
_logger = loggerFactory.CreateLogger(nameof(AuthorizationServer));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override NetCoreServer.TcpSession CreateSession()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStarting()
|
||||||
|
{
|
||||||
|
base.OnStarting();
|
||||||
|
_logger.LogInformation(" is starting");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStarted()
|
||||||
|
{
|
||||||
|
base.OnStarted();
|
||||||
|
_logger.LogInformation(" is started");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStopping()
|
||||||
|
{
|
||||||
|
base.OnStopping();
|
||||||
|
_logger.LogInformation(" is stopping");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStopped()
|
||||||
|
{
|
||||||
|
base.OnStopped();
|
||||||
|
_logger.LogInformation(" is stopped");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnError(System.Net.Sockets.SocketError error)
|
||||||
|
{
|
||||||
|
_logger.LogError("Authorization server caught an error with code {error}", error);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue