mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-15 12:02:51 +08:00
27 lines
779 B
C#
27 lines
779 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NCaptcha.Abstractions;
|
|
using NCaptcha.AspNetCore.Extensions;
|
|
|
|
namespace OAuth2Integration.ResourceServer.Controllers
|
|
{
|
|
[Route("captcha")]
|
|
public class CaptchaController : Controller
|
|
{
|
|
private readonly ICaptchaGenerator _captchaGenerator;
|
|
|
|
public CaptchaController(ICaptchaGenerator captchaGenerator)
|
|
{
|
|
_captchaGenerator = captchaGenerator;
|
|
}
|
|
|
|
[Produces("image/gif", Type = typeof(FileContentResult))]
|
|
[HttpGet]
|
|
public async Task<IActionResult> OnGetCaptchaAsync() => await _captchaGenerator.GetCaptchaFileResultAsync();
|
|
}
|
|
}
|