Guest User

Untitled

a guest
Mar 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // GET: api/values
  2. [HttpGet]
  3. public IActionResult Get()
  4. {
  5. var scopes = HttpContext.User.FindFirst("http://schemas.microsoft.com/identity/claims/scope")?.Value;
  6. if (!string.IsNullOrEmpty(Startup.ScopeRead) && scopes != null
  7. && scopes.Split(' ').Any(s => s.Equals(Startup.ScopeRead)))
  8. return Ok(new string[] { "value1", "value2" });
  9. else
  10. return Unauthorized();
  11. }
Add Comment
Please, Sign In to add comment