src/Hx.IdentityServer/Controllers/Account/AccountController.cs

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


using Hx.IdentityServer.Common;
using Hx.IdentityServer.Controllers;
using Hx.IdentityServer.Data;
using Hx.IdentityServer.Entity;
using Hx.IdentityServer.Model;
using Hx.IdentityServer.Model.Account;
using Hx.IdentityServer.Model.Models.Account;
using Hx.Sdk.Entity.Extensions;
using IdentityModel;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
using IdentityServer4.Services;
using IdentityServer4.Stores;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;

namespace Hx.IdentityServer.Controllers
{
    /// <summary>
    /// 账户控制器
    /// </summary>
    public class AccountController : BaseController
    {
        private readonly UserManager<ApplicationUser> _userManager;
        private readonly RoleManager<ApplicationRole> _roleManager;
        private readonly ApplicationDbContext _applicationDb;
        public AccountController(UserManager<ApplicationUser> userManager, 
            RoleManager<ApplicationRole> roleManager, ApplicationDbContext  applicationDb)
        {
            _userManager = userManager;
            _roleManager = roleManager;
            _applicationDb = applicationDb;
        }

        #region 用户相关的操作
        [HttpGet]
        [Authorize]
        public ActionResult Index(string returnUrl = null)
        {
            ViewData["IsSuperAdmin"] = this.IsSuperAdmin;
            ViewData["ReturnUrl"] = returnUrl;
            return View();
        }

后面还有 308 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。