private DECommonScope(IServiceProvider sp, IDEAuthentificatedUser user, bool useAuthentification, string allowGroups) { this.sp = sp ?? throw new ArgumentNullException(nameof(sp)); this.server = sp.GetService <IDEServer>(true); this.user = user; this.userOwner = user == null; this.useAuthentification = useAuthentification; this.allowGroups = allowGroups == "*" || allowGroups == null ? allowAllGroups : (sp.GetService <IDEServer>(true).BuildSecurityTokens(Procs.GetStrings(allowGroups, true)) ?? restrictAllGroups); } // ctor
} // proc DisposeAsync #endregion #region -- User --------------------------------------------------------------- /// <summary>Change the current user on the context, to a server user. Is the given user null, the result is also null.</summary> public async Task AuthentificateUserAsync(IIdentity authentificateUser) { if (authentificateUser != null) { if (user != null) { throw new InvalidOperationException(); } user = await server.AuthentificateUserAsync(authentificateUser); if (user == null) { throw CreateAuthorizationException(false, String.Format("Authentification against the DES-Users failed: {0}.", authentificateUser.Name)); } userOwner = true; } } // proc AuthentificateUser
} // proc AuthentificateUser /// <summary>Change the current user.</summary> /// <param name="user"></param> public void SetUser(IDEAuthentificatedUser user) => this.user = user;
} // ctor /// <summary></summary> /// <param name="sp"></param> /// <param name="user"></param> public DECommonScope(IServiceProvider sp, IDEAuthentificatedUser user) : this(sp, user, user != null, null) { } // ctor