简体   繁体   English

aspnet core RC2何时初始化用户(原则)

[英]aspnet core RC2 When does the User (claimsprincipal) get initialized

In the controller classes you have access to the User, which is just a claimsprincipal. 在控制器类中,您可以访问用户,这只是一个声明原则。 (see below) (见下文)

在此处输入图片说明

At what point does this get initialized? 什么时候初始化? And how, by what method? 以及如何,通过什么方法? Could I do this manually? 我可以手动执行此操作吗?

The reason I ask is because I want to be able to get the user upon logging in, but because they have not yet logged in the User is null. 我问的原因是因为我希望能够在登录时获得用户,但是因为他们尚未登录,所以User为null。 But I want to be able to access the users claims in the login action. 但是我希望能够在登录操作中访问用户声明。

在此处输入图片说明

I figured it out thanks anyways guys. 我想通了,谢谢大家。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM