12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using YBEE.EQM.Core;
- namespace YBEE.EQM.Application;
- /// <summary>
- /// 用户登录认证服务
- /// </summary>
- [ApiDescriptionSettings(Name = "sys-auth")]
- [Route("sys/auth")]
- public class SysAuthAppService(ISysAuthService authService) : IDynamicApiController
- {
- private readonly ISysAuthService _authService = authService;
- /// <summary>
- /// 账户密码登录
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [AllowAnonymous]
- public async Task<AuthOutput> LoginByAccount(LoginInput input)
- {
- return await _authService.LoginByAccount(input);
- }
- /// <summary>
- /// 退出登录
- /// </summary>
- /// <returns></returns>
- [AllowAnonymous]
- public async Task Logout()
- {
- await _authService.Logout();
- }
- /// <summary>
- /// 获取当前登录用户信息
- /// </summary>
- /// <returns></returns>
- public async Task<LoginOutput> GetLoginUser()
- {
- return await _authService.GetLoginUser();
- }
- /// <summary>
- /// 获取图形验证码
- /// </summary>
- /// <returns></returns>
- [AllowAnonymous, DisableOpLog]
- public async Task<GeneralCaptchaOutput> GetCaptcha()
- {
- return await _authService.GetCaptcha();
- }
- /// <summary>
- /// 校验图形验证码
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [AllowAnonymous, DisableOpLog]
- public async Task<GeneralCaptchaOutput> VerifyCaptcha(GeneralCaptchaInput input)
- {
- return await _authService.VerifyCaptcha(input);
- }
- /// <summary>
- /// 获取临时密码
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [AllowAnonymous, DisableOpLog]
- [HttpPost]
- public List<string> GetTempPassword([Required] List<string> input)
- {
- return _authService.GetTempPassword(input);
- }
- [AllowAnonymous, DisableOpLog]
- public string GetPbkdf2(string pwd)
- {
- return PBKDF2Encryption.Encrypt(pwd);
- }
- [AllowAnonymous, DisableOpLog]
- public bool ComparePbkdf2(string pwd, string pbpwd)
- {
- return PBKDF2Encryption.Compare(pwd, pbpwd);
- }
- }
|