abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.97k stars 3.45k forks source link

Can not overring TokenController in separate identity server #15120

Closed YangYang1082 closed 1 year ago

YangYang1082 commented 1 year ago

Is there an existing issue for this?

Description

I want to overriding the TokenController in auth server follow #7766, but it doesn't work.

Reproduction Steps

  1. Use abp new Tutorial -u angular -dbms PostgreSQL --separate-identity-server initialize a project.
  2. Overrding TokenController in auth server project:
    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(TokenController))]
    public class MyTokenController : TokenController
    {
        public override Task<IActionResult> HandleAsync()
        {
            throw new UserFriendlyException("This done not work!");
            //return base.HandleAsync();
        }
    }
  3. Run auth server and post {auth_server_url}/connect/token , will not throw UserFriendlyException.

Expected behavior

Run auth server and post {auth_server_url}/connect/token , it will enter the overrid method.

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

6.0

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

Separate Auth Server

Operation System

Windows (Default)

Other information

No response

maliming commented 1 year ago

Run auth server and post {auth_server_url}/connect/token , will not throw UserFriendlyException.

https://github.com/abpframework/abp/blob/dev/modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs#L32