コード例 #1
0
        /// <summary>
        /// Gets membership id
        /// </summary>
        /// <param name="senderInfo">Sender information</param>
        /// <returns>Collection of management system execution state keys</returns>
        public override string GetMembershipId(SenderInfo senderInfo)
        {
            if ((senderInfo == null) || (senderInfo.Principal == null) || (senderInfo.Principal.Identity == null))
            {
                throw new ArgumentNullException("senderInfo");
            }

            return RbacSystem.Current.GetMembershipId(new RbacUser.RbacUserInfo(senderInfo.Principal.Identity));
        }
コード例 #2
0
ファイル: CustomAuthorization.cs プロジェクト: nickchal/pash
        /// <summary>
        /// Authorize a user. 
        /// </summary>
        /// <param name="senderInfo">Sender information</param>
        /// <param name="userQuota">User quota value</param>
        /// <returns>User context in which to execute PowerShell cmdlet</returns>
        public override WindowsIdentity AuthorizeUser(SenderInfo senderInfo, out UserQuota userQuota)
        {
            var maxConcurrentRequests = ConfigurationManager.AppSettings["MaxConcurrentRequests"];
            var maxRequestsPerTimeslot = ConfigurationManager.AppSettings["MaxRequestsPerTimeslot"];
            var timeslotSize = ConfigurationManager.AppSettings["TimeslotSize"];

            userQuota = new UserQuota(
                maxConcurrentRequests != null ? int.Parse(maxConcurrentRequests, CultureInfo.CurrentUICulture) : DefaultMaxConcurrentRequests,
                maxRequestsPerTimeslot != null ? int.Parse(maxRequestsPerTimeslot, CultureInfo.CurrentUICulture) : DefaultMaxRequestsPerTimeslot,
                timeslotSize != null ? int.Parse(timeslotSize, CultureInfo.CurrentUICulture) : DefaultTimeslotSize);

            return WindowsIdentity.GetCurrent();
        }
コード例 #3
0
        /// <summary>
        /// Authorizes a user
        /// </summary>
        /// <param name="senderInfo">User information</param>
        /// <param name="quota">Returns user quota</param>
        /// <returns>WindowsIdentity, if the user is authorized else throws an exception</returns>
        public override WindowsIdentity AuthorizeUser(SenderInfo senderInfo, out UserQuota quota)
        {
            if ((senderInfo == null) || (senderInfo.Principal == null) || (senderInfo.Principal.Identity == null))
            {
                throw new ArgumentNullException("senderInfo");
            }

            if (senderInfo.Principal.Identity.IsAuthenticated == false)
            {
                throw new ArgumentException("User is not authenticated");
            }

            RbacUser.RbacUserInfo userInfo = null;
            if (senderInfo.Principal.WindowsIdentity != null)
            {
                userInfo = new RbacUser.RbacUserInfo(senderInfo.Principal.WindowsIdentity);
            }
            else
            {
                userInfo = new RbacUser.RbacUserInfo(senderInfo.Principal.Identity);
            }

            return RbacSystem.Current.AuthorizeUser(userInfo, out quota);
        }
コード例 #4
0
 public abstract string GetMembershipId(SenderInfo senderInfo);
コード例 #5
0
 public abstract WindowsIdentity AuthorizeUser(SenderInfo senderInfo, out UserQuota userQuota);
コード例 #6
0
ファイル: CustomAuthorization.cs プロジェクト: nickchal/pash
 /// <summary>
 /// Gets membership id
 /// </summary>
 /// <param name="senderInfo">Sender information</param>
 /// <returns>Always returns same membership id for all users which means all users are in same group</returns>
 public override string GetMembershipId(SenderInfo senderInfo)
 {
     return DefaultManagementSystemStateId;
 }
コード例 #7
0
ファイル: CustomAuthorization.cs プロジェクト: nickchal/pash
		public abstract string GetMembershipId(SenderInfo senderInfo);
コード例 #8
0
ファイル: CustomAuthorization.cs プロジェクト: nickchal/pash
		public abstract WindowsIdentity AuthorizeUser(SenderInfo senderInfo, out UserQuota userQuota);