예제 #1
0
 public RBACContext(DelegatedPrincipal executingUser, SerializedAccessToken impersonatedUser, IList <RoleType> roleTypeFilter, List <RoleEntry> sortedRoleEntryFilter, IList <RoleType> logonUserRequiredRoleTypes, bool callerCheckedAccess) : this(impersonatedUser, roleTypeFilter, sortedRoleEntryFilter, logonUserRequiredRoleTypes, callerCheckedAccess)
 {
     if (executingUser == null)
     {
         throw new ArgumentNullException("executingUser");
     }
     this.AuthenticationType      = DelegatedPrincipal.DelegatedAuthenticationType;
     this.ExecutingUserName       = executingUser.DisplayName;
     this.serializedExecutingUser = executingUser.Identity.Name;
     this.contextType             = RBACContext.RBACContextType.Delegated;
 }
예제 #2
0
 public RBACContext(SerializedAccessToken executingUser, SerializedAccessToken impersonatedUser, IList <RoleType> roleTypeFilter, List <RoleEntry> sortedRoleEntryFilter, IList <RoleType> logonUserRequiredRoleTypes, bool callerCheckedAccess) : this(impersonatedUser, roleTypeFilter, sortedRoleEntryFilter, logonUserRequiredRoleTypes, callerCheckedAccess)
 {
     if (executingUser == null)
     {
         throw new ArgumentNullException("executingUser");
     }
     this.serializedExecutingUser = executingUser.ToString();
     this.ExecutingUserName       = executingUser.LogonName;
     this.AuthenticationType      = executingUser.AuthenticationType;
     this.contextType             = RBACContext.RBACContextType.Windows;
 }
예제 #3
0
 private RBACContext(SerializedAccessToken impersonatedUser, IList <RoleType> roleTypeFilter, List <RoleEntry> sortedRoleEntryFilter, IList <RoleType> logonUserRequiredRoleTypes, bool callerCheckedAccess)
 {
     if (impersonatedUser != null)
     {
         this.roleTypeFilter                 = roleTypeFilter;
         this.sortedRoleEntryFilter          = sortedRoleEntryFilter;
         this.logonUserRequiredRoleTypes     = logonUserRequiredRoleTypes;
         this.callerCheckedAccess            = callerCheckedAccess;
         this.impersonatedUserSddl           = impersonatedUser.UserSid;
         this.impersonatedAuthenticationType = impersonatedUser.AuthenticationType;
     }
 }
예제 #4
0
        // Token: 0x060003FC RID: 1020 RVA: 0x00017330 File Offset: 0x00015530
        public static string GetSerializedAccessTokenString(this IRequestContext requestContext)
        {
            if (requestContext == null)
            {
                throw new ArgumentNullException("requestContext");
            }
            string result = null;

            try
            {
                IIdentity callerIdentity = requestContext.GetCallerIdentity();
                using (ClientSecurityContext clientSecurityContext = IdentityUtils.ClientSecurityContextFromIdentity(callerIdentity, true))
                {
                    result = new SerializedAccessToken(IIdentityExtensions.GetSafeName(callerIdentity, true), callerIdentity.AuthenticationType, clientSecurityContext).ToString();
                }
            }
            catch (AuthzException ex)
            {
                throw new HttpException(401, ex.Message);
            }
            return(result);
        }
예제 #5
0
        public static string GetSerializedAccessTokenString(this HttpContext httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            string result = null;

            try
            {
                IIdentity callerIdentity = httpContext.GetCallerIdentity();
                using (ClientSecurityContext clientSecurityContext = callerIdentity.CreateClientSecurityContext(true))
                {
                    SerializedAccessToken serializedAccessToken = new SerializedAccessToken(callerIdentity.GetSafeName(true), callerIdentity.AuthenticationType, clientSecurityContext);
                    result = serializedAccessToken.ToString();
                }
            }
            catch (AuthzException ex)
            {
                throw new HttpException(401, ex.Message);
            }
            return(result);
        }
예제 #6
0
        public static EcpLogonInformation Create(string logonAccountSddlSid, string logonMailboxSddlSid, string targetMailboxSddlSid, SerializedAccessToken proxySecurityAccessToken)
        {
            SecurityIdentifier securityIdentifier       = new SecurityIdentifier(logonMailboxSddlSid);
            IIdentity          logonUserIdentity        = (proxySecurityAccessToken != null) ? new SerializedIdentity(proxySecurityAccessToken) : new GenericSidIdentity(logonMailboxSddlSid, string.Empty, securityIdentifier);
            IIdentity          impersonatedUserIdentity = (string.IsNullOrEmpty(targetMailboxSddlSid) || logonMailboxSddlSid == targetMailboxSddlSid) ? null : new GenericSidIdentity(targetMailboxSddlSid, string.Empty, new SecurityIdentifier(targetMailboxSddlSid));

            return(new EcpLogonInformation(securityIdentifier, logonUserIdentity, impersonatedUserIdentity));
        }
예제 #7
0
 public RBACContext(SerializedAccessToken executingUser) : this(executingUser, null, null, null, null, false)
 {
 }