Skip to content

Instantly share code, notes, and snippets.

@merken
Created September 25, 2018 20:34
Show Gist options
  • Save merken/417e435978b76069763d5c94279f72d4 to your computer and use it in GitHub Desktop.
Save merken/417e435978b76069763d5c94279f72d4 to your computer and use it in GitHub Desktop.
UsersController.3.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using auth.api.Security;
using auth.api.Security.AzureAd;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace auth.api.Controllers
{
[Route("api/users")]
[ApiController]
[Authorize(AuthenticationSchemes = Constants.AzureAdScheme)]
public class UsersController : ControllerBase
{
// GET api/values
[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
return new string[] { "maarten", HttpContext.User.Identity.Name };
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment