JNPF快速开发平台基于 Spring Security、Spring OAuth2、JWT 实现的统一认证服务中心,登录基于 spring security 的标准登录流程。客户端授权支持 oauth2.0 的四种授权模式:授权码模式、简化模式、密码模式、客户端模式,授权流程跟标准的 oauth2 流程一致。web 端采用简化模式(implicit)登录系统,移动端可使用密码模式(password)登录系统。同时还支持基于Spring Social的三方账号登录方式,如微信/QQ、支付宝、微博等,并提供拓展模式,支持更多三方渠道。
基于Mybatis-plus-generator自定义了一套代码生成器, 通过配置数据库字段的注释,可在线生成WEB前端(vue)、移动端(vue)、后端(controller、entity、mapperxml、service)等代码,极大减少开发难度,减少70%以上的开发任务。
private string _hostname = Dns.GetHostName();
[Benchmark(OperationsPerInvoke = 1000, Baseline = true)]
public async Task GetHostAddresses()
{
for (int i = 0; i < 1_000; i++)
await Dns.GetHostAddressesAsync(_hostname);
}
[Benchmark(OperationsPerInvoke = 1000)]
public async Task GetHostAddresses_OneFamily()
{
for (int i = 0; i < 1_000; i++)
await Dns.GetHostAddressesAsync(_hostname, AddressFamily.InterNetwork);
}
private Uri _uri = new Uri("http://dot.net");
[Benchmark]
public string GetComponents() => _uri.GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped);
[Benchmark]
public Uri NewUri() => new Uri("http://dot.net");
[Benchmark]
public string PathAndQuery() => _uri.PathAndQuery;
private FileStream _fileStream;
private byte[] _buffer = new byte[1024];
[Params(false, true)]
public bool IsAsync { get; set; }
[Params(1, 4096)]
public int BufferSize { get; set; }
[GlobalSetup]
public void Setup()
{
byte[] data = new byte[10_000_000];
new Random(42).NextBytes(data);
string path = Path.GetTempFileName();
File.WriteAllBytes(path, data);
_fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, BufferSize, IsAsync);
}
[GlobalCleanup]
public void Cleanup()
{
_fileStream.Dispose();
File.Delete(_fileStream.Name);
}
[Benchmark]
public void Read()
{
_fileStream.Position = 0;
while (_fileStream.Read(_buffer
#if !NETCOREAPP2_1_OR_GREATER
, 0, _buffer.Length
#endif
) != 0) ;
}
[Benchmark]
public async Task ReadAsync()
{
_fileStream.Position = 0;
while (await _fileStream.ReadAsync(_buffer
#if !NETCOREAPP2_1_OR_GREATER
, 0, _buffer.Length
#endif
) != 0) ;
}