コード例 #1
0
        public object Get(string id)
        {
            DigestAuthId digestAuthId = new DigestAuthId(id);

            Site site = digestAuthId.SiteId == null ? null : SiteHelper.GetSite(digestAuthId.SiteId.Value);

            return(DigestAuthenticationHelper.ToJsonModel(site, digestAuthId.Path));
        }
コード例 #2
0
        public object Get()
        {
            // Check if the scope of the request is for site or application
            Site   site = ApplicationHelper.ResolveSite();
            string path = ApplicationHelper.ResolvePath();

            return(DigestAuthenticationHelper.ToJsonModel(site, path));
        }
コード例 #3
0
        public async Task <object> Post()
        {
            if (DigestAuthenticationHelper.IsFeatureEnabled())
            {
                throw new AlreadyExistsException(DigestAuthenticationHelper.FEATURE_NAME);
            }

            await DigestAuthenticationHelper.SetFeatureEnabled(true);

            dynamic auth = DigestAuthenticationHelper.ToJsonModel(null, null);

            return(Created(DigestAuthenticationHelper.GetLocation(auth.id), auth));
        }
コード例 #4
0
        public object Patch(string id, [FromBody] dynamic model)
        {
            DigestAuthId digestAuthId = new DigestAuthId(id);

            Site site = digestAuthId.SiteId == null ? null : SiteHelper.GetSite(digestAuthId.SiteId.Value);

            // Targetting section for a site, but unable to find that site
            if (digestAuthId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            string configPath = model == null ? null : ManagementUnit.ResolveConfigScope(model);

            DigestAuthenticationHelper.UpdateSettings(model, site, digestAuthId.Path, configPath);

            ManagementUnit.Current.Commit();

            return(DigestAuthenticationHelper.ToJsonModel(site, digestAuthId.Path));
        }