コード例 #1
0
        public async Task <IActionResult> GetUserProfiles()
        {
            // Authroize
            var loggedInUsername    = UsernameNormalizer.Normalize(HttpContext.User.Identity.Name);
            var authorizationResult = await authorizationModule.AuthorizeAsync(new ViewUserProfilesResoruceDescription(), loggedInUsername);

            if (!authorizationResult.IsAuthorized)
            {
                return(StatusCode((int)HttpStatusCode.Unauthorized, "Not authorized"));
            }

            var userProfiles = authenticationModule.GetAllUserProfilesAsync();

            return(userProfiles.ToFileStreamResult());
        }