protected Principal getSubjectPrincipal() { if (subjectInteraction == null) { Class<?> clazz = loadClass(getClass(), subjectInteractionClassName); try { subjectInteraction = (SubjectSecurityInteraction) clazz.newInstance(); subjectInteraction.setSecurityDomain(context.getRealm().getContainer().getName()); } catch (Exception e) { throw new RuntimeException(e); } } Subject subject = subjectInteraction.get(); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); if (!principals.isEmpty()) { return subject.getPrincipals().iterator().next(); } } return null; }
protected Principal getSubjectPrincipal() { if (subjectInteraction == null) { Class<?> clazz = loadClass(getClass(), subjectInteractionClassName); try { subjectInteraction = (SubjectSecurityInteraction) clazz.newInstance(); subjectInteraction.setSecurityDomain(context.getRealm().getContainer().getName()); } catch (Exception e) { throw new RuntimeException(e); } } Subject subject = subjectInteraction.get(); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); if (!principals.isEmpty()) { return subject.getPrincipals().iterator().next(); } } return null; }
protected Principal getSubjectPrincipal() { if (subjectInteraction == null) { Class<?> clazz = loadClass(getClass(), subjectInteractionClassName); try { subjectInteraction = (SubjectSecurityInteraction) clazz.newInstance(); subjectInteraction.setSecurityDomain(context.getRealm().getContainer().getName()); } catch (Exception e) { throw new RuntimeException(e); } } Subject subject = subjectInteraction.get(); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); if (!principals.isEmpty()) { return subject.getPrincipals().iterator().next(); } } return null; }