feat: 新增Oauth鉴权模块,支持qq登录、gitee登录

This commit is contained in:
橙子
2024-01-07 13:34:50 +08:00
parent ebad623032
commit add374f0a7
43 changed files with 1318 additions and 173 deletions

View File

@@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Quartz.Logging;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
namespace Yi.Framework.Bbs.Application.Services.Authentication
{
public class QQAuthService : IRemoteService, ITransientDependency
{
private HttpContext HttpContext { get; set; }
private ILogger<QQAuthService> _logger;
public QQAuthService(IHttpContextAccessor httpContextAccessor, ILogger<QQAuthService> logger)
{
_logger = logger;
HttpContext = httpContextAccessor.HttpContext ?? throw new ApplicationException("未注册Http");
}
[HttpGet("/auth/qq")]
public async Task AuthQQAsync()
{
var data = await HttpContext.AuthenticateAsync("QQ");
_logger.LogError($"QQ回调信息:{Newtonsoft.Json.JsonConvert.SerializeObject(data)}");
_logger.LogError($"QQ回调身份:{Newtonsoft.Json.JsonConvert.SerializeObject(data.Principal)}");
}
}
}

View File

@@ -15,8 +15,8 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
public class BbsDictionaryDataSeed : IDataSeedContributor, ITransientDependency
{
private ISqlSugarRepository<DictionaryEntity> _repository;
private ISqlSugarRepository<DictionaryTypeEntity> _typeRepository;
public BbsDictionaryDataSeed(ISqlSugarRepository<DictionaryEntity> repository, ISqlSugarRepository<DictionaryTypeEntity> typeRepository) {
private ISqlSugarRepository<DictionaryTypeAggregateRoot> _typeRepository;
public BbsDictionaryDataSeed(ISqlSugarRepository<DictionaryEntity> repository, ISqlSugarRepository<DictionaryTypeAggregateRoot> typeRepository) {
_repository=repository;
_typeRepository=typeRepository;
@@ -194,10 +194,10 @@ namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds
return entities;
}
public List<DictionaryTypeEntity> GetSeedDictionaryTypeData()
public List<DictionaryTypeAggregateRoot> GetSeedDictionaryTypeData()
{
List<DictionaryTypeEntity> entities = new List<DictionaryTypeEntity>();
DictionaryTypeEntity dict1 = new DictionaryTypeEntity()
List<DictionaryTypeAggregateRoot> entities = new List<DictionaryTypeAggregateRoot>();
DictionaryTypeAggregateRoot dict1 = new DictionaryTypeAggregateRoot()
{
DictName = "BBS类型标签",