Exemplo n.º 1
0
        public async Task <object> Post()
        {
            if (WindowsAuthenticationHelper.IsFeatureEnabled())
            {
                throw new AlreadyExistsException(WindowsAuthenticationHelper.FEATURE_NAME);
            }

            await WindowsAuthenticationHelper.SetFeatureEnabled(true);

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

            return(Created(WindowsAuthenticationHelper.GetLocation(auth.id), auth));
        }
Exemplo n.º 2
0
        public async Task Delete(string id)
        {
            WinAuthId winAuthId = new WinAuthId(id);

            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;

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

            if (site != null)
            {
                WindowsAuthenticationHelper.GetSection(site, winAuthId.Path, ManagementUnit.ResolveConfigScope()).RevertToParent();
                ManagementUnit.Current.Commit();
            }

            if (winAuthId.SiteId == null && WindowsAuthenticationHelper.IsFeatureEnabled())
            {
                await WindowsAuthenticationHelper.SetFeatureEnabled(false);
            }
        }