public async Task <IActionResult> GetUser( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "users/{userPrincipalName}")] HttpRequest req, string userPrincipalName, ILogger log) { var user = await graphServiceClient.Users[userPrincipalName].Request().Select(userProperties).GetAsync(); log.LogInformation("Customer: {Customer}", user.AdditionalData[extensionService.GetExtensionByName(CustomerClaim)]); return(new OkObjectResult(user)); }
public Functions(IConfidentialClientApplication confidentialClientApplication, IGraphServiceClient graphServiceClient, ExtensionService extensionService, AuthorizationService authorizationService, IApiService apiService) { this.confidentialClientApplication = confidentialClientApplication; this.graphServiceClient = graphServiceClient; this.extensionService = extensionService; this.authorizationService = authorizationService; this.apiService = apiService; userProperties = $"{nameof(User.Id)}, {nameof(User.DisplayName)}, {nameof(User.GivenName)}, {nameof(User.Surname)}, {nameof(User.Identities)}, {extensionService.GetExtensionByName(CustomerClaim)}"; }