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)); }
public async Task Delete(string id) { DigestAuthId digestAuthId = new DigestAuthId(id); Context.Response.StatusCode = (int)HttpStatusCode.NoContent; Site site = (digestAuthId.SiteId != null) ? SiteHelper.GetSite(digestAuthId.SiteId.Value) : null; if (site != null) { DigestAuthenticationHelper.GetSection(site, digestAuthId.Path, ManagementUnit.ResolveConfigScope()).RevertToParent(); ManagementUnit.Current.Commit(); } if (digestAuthId.SiteId == null && DigestAuthenticationHelper.IsFeatureEnabled()) { await DigestAuthenticationHelper.SetFeatureEnabled(false); } }