Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A1804200B45 for ; Fri, 15 Jul 2016 16:49:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A035D160A61; Fri, 15 Jul 2016 14:49:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EA41C160A79 for ; Fri, 15 Jul 2016 16:49:21 +0200 (CEST) Received: (qmail 8649 invoked by uid 500); 15 Jul 2016 14:49:20 -0000 Mailing-List: contact dev-help@shiro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shiro.apache.org Delivered-To: mailing list dev@shiro.apache.org Received: (qmail 8395 invoked by uid 99); 15 Jul 2016 14:49:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jul 2016 14:49:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id B91E12C0034 for ; Fri, 15 Jul 2016 14:49:20 +0000 (UTC) Date: Fri, 15 Jul 2016 14:49:20 +0000 (UTC) From: "Brian Demers (JIRA)" To: dev@shiro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (SHIRO-380) runAs feature (still) doesn't work MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 15 Jul 2016 14:49:22 -0000 [ https://issues.apache.org/jira/browse/SHIRO-380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Brian Demers closed SHIRO-380. ------------------------------ Resolution: Fixed > runAs feature (still) doesn't work > ---------------------------------- > > Key: SHIRO-380 > URL: https://issues.apache.org/jira/browse/SHIRO-380 > Project: Shiro > Issue Type: Bug > Components: Realms > Affects Versions: 1.2.1 > Reporter: Jochen Munz > Labels: principal,, shiro,, subject > Fix For: 1.2.2 > > Attachments: SHIRO-380-patch1.diff, shiro_380_webapp.tgz > > > Right after SecurityUtils.getSubject().runAs(new new SimplePrincipalCollection(){...}) > SecurityUtils.getSubject().getPrincipal() returns correct new Principal > SecurityUtils.getSubject()..getPreviousPrincipals() returns correct original Principal > but DefaultSubjectDAO merge principals in method > protected void mergePrincipals(Subject subject) { > PrincipalCollection currentPrincipals = subject.getPrincipals(); > ... > if (session == null) { > ... > } else { > PrincipalCollection existingPrincipals = (PrincipalCollection) session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); > if (CollectionUtils.isEmpty(currentPrincipals)) { > ... > } else { > if (!currentPrincipals.equals(existingPrincipals)) { > session.setAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY, currentPrincipals); > } > } > } > and after that > SecurityUtils.getSubject().getPrincipal() and SecurityUtils.getSubject().getPreviousPrincipals() both returns new Principal - this is wrong behavior -- This message was sent by Atlassian JIRA (v6.3.4#6332)