コード例 #1
0
        public TM_Authentication mapUserRoles(bool _disable_CSRF_Check)
        {
            disable_CSRF_Check = _disable_CSRF_Check;
            //"[TM_Authentication] mapUserRoles".info();
            if (sessionID == Guid.Empty || sessionID.validSession() == false)
                /*if (SingleSignOn.singleSignOn_Enabled)
                {
                    sessionID = new SingleSignOn().authenticateUserBasedOn_SSOToken();
                }
                else*/
                    if (WindowsAuthentication.windowsAuthentication_Enabled)
                {
                    sessionID = new WindowsAuthentication().authenticateUserBaseOn_ActiveDirectory();
                }

            var userGroup = UserGroup.None;
            if (sessionID != Guid.Empty)
            {
                if (check_CSRF_Token())		// only map the roles if the CSRF check passed
                {
                    userGroup = new UserRoleBaseSecurity().MapRolesBasedOnSessionGuid(sessionID);
                }
                //else
                //    "[TM_Authentication] check_CSRF_Token failed".error();
            }
            if (userGroup == UserGroup.None)
            {
                if (TMConfig.Current.ShowContentToAnonymousUsers)
                    UserGroup.Reader.setThreadPrincipalWithRoles();
                else
                    UserGroup.Anonymous.setThreadPrincipalWithRoles();
            }
            return this;
        }
コード例 #2
0
		public TM_Authentication mapUserRoles()
		{
            if (WindowsAuthentication.windowsAuthentication_Enabled)
				if (sessionID == Guid.Empty || sessionID.validSession() == false)
					sessionID = new WindowsAuthentication().authenticateUserBaseOnActiveDirectory();

			
            var userGroup = UserGroup.None;
			if (sessionID != Guid.Empty)
			{
				if (check_CSRF_Token())		// only map the roles if the CSRF check passed
				{
					userGroup = new UserRoleBaseSecurity().MapRolesBasedOnSessionGuid(sessionID);					
				}
			}
            if (userGroup == UserGroup.None)
            {
                if (TMConfig.Current.ShowContentToAnonymousUsers)
                    UserGroup.Reader.setThreadPrincipalWithRoles();
                else
                    UserGroup.Anonymous.setThreadPrincipalWithRoles();
            }
			return this;
		}