示例#1
0
        public async Task <ActionResult> Edit()
        {
            var http = await _rest.GetClientAsync();

            var json = await http.GetStringAsync($"{RESTService.Url}/tenant/oauth2");

            var tenant = JObject.Parse(json);

            return(View(new TenantDetails
            {
                Name = tenant["name"].Value <string>(),
                LongName = tenant["description"].Value <string>(),
                RequireMFA = tenant["requireMFA"].Value <bool>()
            }));
        }
示例#2
0
        public async Task <ActionResult> Edit()
        {
            var tenantIdClaim = User.FindFirst("appTenantId");

            if (tenantIdClaim != null)
            {
                var http = await _rest.GetClientAsync();

                var tenantId = tenantIdClaim.Value;
                var json     = await http.GetStringAsync($"{RESTService.Url}/tenant/oauth2/{tenantId}");

                var group = JObject.Parse(json);
                return(View(new TenantDetails
                {
                    Name = group["name"].Value <string>(),
                    LongName = group["description"].Value <string>()
                }));
            }
            return(View());
        }
示例#3
0
        // GET: Members
        public async Task <IActionResult> Index()
        {
            var tenantIdClaim = User.FindFirst("appTenantId"); // pwd reset does not return it;

            if (tenantIdClaim != null)
            {
                var http = await _rest.GetClientAsync();

                var tenantId = tenantIdClaim.Value;
                var json     = await http.GetStringAsync($"{RESTService.Url}/tenant/oauth2/members");

                var members = JArray.Parse(json).Select(m => new Member
                {
                    Id          = m["userId"].Value <string>(),
                    Roles       = (m["roles"].ToList().Select(t => t.Value <string>()).Aggregate((i, r) => $"{i}, {r}")),
                    DisplayName = m["name"].Value <string>()
                }).ToList();
                return(View(members));
            }
            return(View());
        }
示例#4
0
        public async Task <ActionResult> Edit()
        {
            var http = await _rest.GetClientAsync();

            var json = await http.GetStringAsync($"{RESTService.Url}/tenant/oauth2");

            var tenant  = JObject.Parse(json);
            var details = new TenantDetails
            {
                Name       = tenant["name"].Value <string>(),
                LongName   = tenant["description"].Value <string>(),
                RequireMFA = tenant["requireMFA"].Value <bool>(),
            };
            var idp = tenant["identityProvider"].Value <string>();

            if (!String.IsNullOrEmpty(idp) && idp.Equals("commonaad"))
            {
                details.OwnerIssuer = tenant["directoryId"].Value <string>();
                details.AllowNoInviteFromSameIssuer = tenant["allowSameIssuerMembers"].Value <bool>();
            }
            return(View(details));
        }