Home > Net > Webapi string of data, someone help me out? ($)
Webapi string of data, someone help me out? ($)
Time:11-21
This matter is,
Use request authentication is behind client_credentials front-end is a small program
Each a small program after the user login will get a token, then request other API with the token
Now found that sometimes is another user request data API,
Such as:
When A login, send into the token, will record the following information
Public Overrides the Function GrantClientCredentials (context As OAuthGrantClientCredentialsContext) As a Task
Dim oAuthIdentity=New ClaimsIdentity (context. The Options. AuthenticationType) OAuthIdentity. AddClaim (New Claim (" code ", the Me. Logininfo. Code))
Dim ticket=New AuthenticationTicket (oAuthIdentity, New AuthenticationProperties ()) The context. Validated (ticket)
Context. OwinContext. The Response Headers. The Add (" Access - Control - Allow - Origin, "{}" * ")
Return MyBase. GrantClientCredentials (context) End the Function
When A request other API, then call Dim ClaimsPrincipal As ClaimsPrincipal=HttpContext. Current. The value of the User to obtain code but sometimes get A is the value of another User,