Return-Path: X-Original-To: apmail-shiro-user-archive@www.apache.org Delivered-To: apmail-shiro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 51F14C73F for ; Sun, 30 Nov 2014 12:51:30 +0000 (UTC) Received: (qmail 11439 invoked by uid 500); 30 Nov 2014 12:51:30 -0000 Delivered-To: apmail-shiro-user-archive@shiro.apache.org Received: (qmail 11403 invoked by uid 500); 30 Nov 2014 12:51:30 -0000 Mailing-List: contact user-help@shiro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@shiro.apache.org Delivered-To: mailing list user@shiro.apache.org Received: (qmail 11393 invoked by uid 99); 30 Nov 2014 12:51:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Nov 2014 12:51:30 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of ooo_saturn7@mail.ru does not designate 162.253.133.43 as permitted sender) Received: from [162.253.133.43] (HELO mwork.nabble.com) (162.253.133.43) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Nov 2014 12:51:03 +0000 Received: from mjim.nabble.com (unknown [162.253.133.84]) by mwork.nabble.com (Postfix) with ESMTP id 8EE9BBB065A for ; Sun, 30 Nov 2014 04:51:02 -0800 (PST) Date: Sun, 30 Nov 2014 05:51:02 -0700 (MST) From: P82 To: user@shiro.apache.org Message-ID: <1417351862404-7580344.post@n2.nabble.com> Subject: Shiro principals. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org For my application I need to keep some user info. However to keep principal as list (not hashmap) is not very good. So I have three questions: 1) Are principals linked with subject - I mean that subject.getPrincipals() will return ONLY THIS SUBJECT PRINCIPALS? 2) When will PrincipalMap be ready for production mode? I mean, I want to use: Object principal = subject.getPrincipals().get(principalName); 3) Can I do like this - I mean will the following code be right and safe?: public class SubjectPrincipals{ private int id; private String name; settters+getters } After that in custom jdbcrealm in doGetAuthenticationInfo method: this line: info = new SimpleAuthenticationInfo(username, password.toCharArray(), getName()); replace for: SubjectPrincipals princip=SubjectPrincipals(id,username); info = new SimpleAuthenticationInfo(princip, password.toCharArray(), getName()); After that in any code: Subject currentUser = SecurityUtils.getSubject(); SubjectPrincipals princip=(SubjectPrincipals)currentUser.getPrincipal(); System.out.println("THE NAME OF CURRENT USER IS:"+princip.getName) -- View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-principals-tp7580344.html Sent from the Shiro User mailing list archive at Nabble.com.