AbpSession extension and abpabpsession

Source: Internet
Author: User

AbpSession extension and abpabpsession

The permission management of Abp is based on Identity, and all extensions are also based on claims. Claims has many default attributes and specific connections

For details about Identity, refer to yuanyou blog

After inheriting the UserManager of Microsoft. AspNet. Identity, we directly call await base. CreateIdentityAsync (user, authenticationType). This method completes logon and can be obtained after logon.

HttpContext. Current. User. You can use HttpContext to obtain information about the initialized Claims.
ClaimsPrincipal principal = HttpContext.Current.User as ClaimsPrincipal;if (null != principal){   foreach (Claim claim in principal.Claims)   {      Response.Write("CLAIM TYPE: " + claim.Type + "; CLAIM VALUE: " + claim.Value + "</br>");   }}

After learning about the basic functions, You can scale them as needed,

Define ClaimsType

/// <Summary> DataPermissions </summary>
Public const string DataPermissions = "http://www.aspnetboilerplate.com/identity/claims/dataPermissions ";

Obtain Claims

View Code

After logon, add Claims identity. AddClaim (new Claim (AbpClaimTypes. DataPermissions, value to be added ));

Get the DataPermissions of the AbpSession

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.