feat: 添加超级用户默认密码
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Domain.Shared.Options
|
||||||
|
{
|
||||||
|
public class RbacOptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 超级管理员默认密码
|
||||||
|
/// </summary>
|
||||||
|
public string AdminPassword { get; set; } = "123456";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
using Volo.Abp.Domain;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Volo.Abp.Domain;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
using Yi.Framework.Mapster;
|
using Yi.Framework.Mapster;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Options;
|
||||||
|
|
||||||
namespace Yi.Framework.Rbac.Domain.Shared
|
namespace Yi.Framework.Rbac.Domain.Shared
|
||||||
{
|
{
|
||||||
@@ -9,6 +12,12 @@ namespace Yi.Framework.Rbac.Domain.Shared
|
|||||||
)]
|
)]
|
||||||
public class YiFrameworkRbacDomainSharedModule : AbpModule
|
public class YiFrameworkRbacDomainSharedModule : AbpModule
|
||||||
{
|
{
|
||||||
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
|
{
|
||||||
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
Configure<JwtOptions>(configuration.GetSection(nameof(JwtOptions)));
|
||||||
|
|
||||||
|
Configure<RbacOptions>(configuration.GetSection(nameof(RbacOptions)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
using Volo.Abp.Data;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Volo.Abp.Data;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
using Yi.Framework.Rbac.Domain.Entities;
|
using Yi.Framework.Rbac.Domain.Entities;
|
||||||
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Options;
|
||||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||||
|
|
||||||
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||||
@@ -9,9 +11,11 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
|||||||
public class UserDataSeed : IDataSeedContributor, ITransientDependency
|
public class UserDataSeed : IDataSeedContributor, ITransientDependency
|
||||||
{
|
{
|
||||||
private ISqlSugarRepository<UserEntity> _repository;
|
private ISqlSugarRepository<UserEntity> _repository;
|
||||||
public UserDataSeed(ISqlSugarRepository<UserEntity> repository)
|
private RbacOptions _options;
|
||||||
|
public UserDataSeed(ISqlSugarRepository<UserEntity> repository, IOptions<RbacOptions> options)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_options = options.Value;
|
||||||
}
|
}
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
public async Task SeedAsync(DataSeedContext context)
|
||||||
{
|
{
|
||||||
@@ -23,7 +27,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
|||||||
Name = "大橙子",
|
Name = "大橙子",
|
||||||
UserName = "cc",
|
UserName = "cc",
|
||||||
Nick = "橙子",
|
Nick = "橙子",
|
||||||
Password = "123456",
|
Password = _options.AdminPassword,
|
||||||
Email = "454313500@qq.com",
|
Email = "454313500@qq.com",
|
||||||
Phone = 13800000000,
|
Phone = 13800000000,
|
||||||
Sex = SexEnum.Male,
|
Sex = SexEnum.Male,
|
||||||
|
|||||||
@@ -98,9 +98,7 @@ namespace Yi.Abp.Web
|
|||||||
});
|
});
|
||||||
|
|
||||||
//jwt鉴权
|
//jwt鉴权
|
||||||
var section = configuration.GetSection(nameof(JwtOptions));
|
var jwtOptions = configuration.GetSection(nameof(JwtOptions)).Get<JwtOptions>();
|
||||||
Configure<JwtOptions>(section);
|
|
||||||
var jwtOptions = section.Get<JwtOptions>();
|
|
||||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||||
.AddJwtBearer(options =>
|
.AddJwtBearer(options =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,5 +36,11 @@
|
|||||||
"Audience": "https://ccnetcore.com",
|
"Audience": "https://ccnetcore.com",
|
||||||
"SecurityKey": "zqxwcevrbtnymu312412ihe9rfwhe78rh23djoi32hrui3ryf9e8wfh34iuj54y0934uti4h97fgw7hf97wyh8yy69520",
|
"SecurityKey": "zqxwcevrbtnymu312412ihe9rfwhe78rh23djoi32hrui3ryf9e8wfh34iuj54y0934uti4h97fgw7hf97wyh8yy69520",
|
||||||
"ExpiresMinuteTime": 86400
|
"ExpiresMinuteTime": 86400
|
||||||
|
},
|
||||||
|
|
||||||
|
//Rbac模块
|
||||||
|
"RbacOptions": {
|
||||||
|
//超级管理员种子数据默认密码
|
||||||
|
"AdminPassword": "123456"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user