Esempio n. 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>()
            }));
        }
Esempio n. 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());
        }
Esempio n. 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());
        }
Esempio n. 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));
        }