Пример #1
0
        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
Пример #2
0
        }         // 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
Пример #3
0
        }         // proc AuthentificateUser

        /// <summary>Change the current user.</summary>
        /// <param name="user"></param>
        public void SetUser(IDEAuthentificatedUser user)
        => this.user = user;
Пример #4
0
        }         // ctor

        /// <summary></summary>
        /// <param name="sp"></param>
        /// <param name="user"></param>
        public DECommonScope(IServiceProvider sp, IDEAuthentificatedUser user)
            : this(sp, user, user != null, null)
        {
        }         // ctor