Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after Application.Contract module depended on the AbpDddApplication module,the AddAlwaysAllowAuthorization invalid #2874

Closed
Maple512 opened this issue Feb 21, 2020 · 4 comments · Fixed by #2875

Comments

@Maple512
Copy link

en: as shown in the title,after Application.Contract module depended on the AbpDddApplicationModule module,the AddAlwaysAllowAuthorization invalid,or after the AbpDddApplicationModule not dependent,AuthorizeAttribute is invalid.

above, found in the xUnit test

Can be reproduced in the Volo.Blogging

zh-Hans: Applicatoin.Contract模块在 DepensNo 中加入 AbpDddApplicationModule 后,AddAlwaysAllowAuthorization 无效,或者 注释 Application.Contract中的[DepensOn(typeof(AbpDddApplicationModule)] 后,[Authorize] 无效

以上,在单元测试中发现

在Volo.Blogging中可以复现

@maliming
Copy link
Member

Please share the code that reproduces your problem.

@Maple512
Copy link
Author

Please share the code that reproduces your problem.

you can try it in the volo.blogging

@maliming
Copy link
Member

Try

public class BloggingApplicationTestModule : AbpModule
{
	public override void ConfigureServices(ServiceConfigurationContext context)
	{
		context.Services.AddAlwaysAllowAuthorization();
		context.Services.Replace(ServiceDescriptor.Singleton<IMethodInvocationAuthorizationService, AlwaysAllowMethodInvocationAuthorizationService>());
	}
}

public class AlwaysAllowMethodInvocationAuthorizationService : IMethodInvocationAuthorizationService
{
	public Task CheckAsync(MethodInvocationAuthorizationContext context)
	{
		return Task.CompletedTask;
	}
}

@Maple512
Copy link
Author

thanks👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants