Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.RealmPrincipal


        Set wrapped = new HashSet();
        for (Iterator iter = subject.getPrincipals().iterator(); iter.hasNext();) {
            Principal principal = (Principal) iter.next();

            wrapped.add(new DomainPrincipal(loginDomainName, principal));
            wrapped.add(new RealmPrincipal(realmName, loginDomainName, principal));
        }
        localSubject.getPrincipals().addAll(wrapped);
        subject.getPrincipals().addAll(localSubject.getPrincipals());

        return result;
View Full Code Here


    }

    public static RealmPrincipal generateRealmPrincipal(final String realm, final String loginDomain, final String className, final String principalName,
                                                        ClassLoader classLoader)
    {
        return new RealmPrincipal(realm, loginDomain, generatePrincipal(className, principalName, classLoader));
    }
View Full Code Here

    public boolean commit() throws LoginException {
        boolean result = delegate.commit();

        for (Principal principal: localSubject.getPrincipals()) {
            wrapped.add(new DomainPrincipal(loginDomainName, principal));
            wrapped.add(new RealmPrincipal(realmName, loginDomainName, principal));
        }
        subject.getPrincipals().addAll(wrapped);
        subject.getPrincipals().addAll(localSubject.getPrincipals());
        subject.getPrivateCredentials().addAll(localSubject.getPrivateCredentials());
        subject.getPublicCredentials().addAll(localSubject.getPublicCredentials());
View Full Code Here

        assertTrue("subject should have one remote principal", subject.getPrincipals(IdentificationPrincipal.class).size() == 1);
        IdentificationPrincipal remote = (IdentificationPrincipal) subject.getPrincipals(IdentificationPrincipal.class).iterator().next();
        assertTrue("subject should be associated with remote id", ContextManager.getRegisteredSubject(remote.getId()) != null);
        assertTrue("subject should have five principals", subject.getPrincipals().size() == 5);
        assertTrue("subject should have two realm principal", subject.getPrincipals(RealmPrincipal.class).size() == 2);
        RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();
        assertTrue("id of principal should be non-zero", principal.getId() != 0);

        context.logout();

        assertTrue("id of subject should be null", ContextManager.getSubjectId(subject) == null);
    }
View Full Code Here

            assertTrue("expected non-null subject", subject != null);
            assertTrue("id of subject should be non-null", ContextManager.getSubjectId(subject) != null);
            assertEquals("subject should have two principals", 2, subject.getPrincipals().size());
            assertEquals("subject should have one realm principal", 1, subject.getPrincipals(RealmPrincipal.class).size());
            RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();
            assertTrue("id of principal should be non-zero", principal.getId() != 0);

            context.logout();

            assertTrue("id of subject should be null", ContextManager.getSubjectId(subject) == null);
        } catch (LoginException e) {
View Full Code Here

        JAASJettyPrincipal result = new JAASJettyPrincipal("default");
        Subject defaultSubject = new Subject();

        DefaultPrincipal principal = securityConfig.getDefaultPrincipal();

        RealmPrincipal realmPrincipal = ConfigurationUtil.generateRealmPrincipal(principal.getPrincipal(), principal.getRealmName());
        if (realmPrincipal == null) throw new GeronimoSecurityException("Unable to create realm principal");
        PrimaryRealmPrincipal primaryRealmPrincipal = ConfigurationUtil.generatePrimaryRealmPrincipal(principal.getPrincipal(), principal.getRealmName());
        if (primaryRealmPrincipal == null) throw new GeronimoSecurityException("Unable to create primary realm principal");

        defaultSubject.getPrincipals().add(realmPrincipal);
View Full Code Here

                            java.security.Principal p = null;
                            try {
                                Class clazz = Class.forName(principal.getClass1());
                                Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                                p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
                                set.add(new RealmPrincipal(realm.getRealmName(), p));
                            } catch (InstantiationException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (IllegalAccessException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (ClassNotFoundException e) {
View Full Code Here

                    java.security.Principal p = null;
                    Class clazz = Class.forName(principal.getClassName());
                    Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                    p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getPrincipalName()});

                    return new RealmPrincipal(realmName, p);
                }
            });
        } catch (PrivilegedActionException e) {
            return null;
        }
View Full Code Here

                    Iterator principals = realm.getPrincipals().iterator();
                    while (principals.hasNext()) {
                        Principal principal = (Principal) principals.next();

                        RealmPrincipal realmPrincipal = ConfigurationUtil.generateRealmPrincipal(principal, realm.getRealmName());

                        if (realmPrincipal == null) throw new GeronimoSecurityException("Unable to create realm principal");

                        principalSet.add(realmPrincipal);
                        if (principal.isDesignatedRunAs()) roleDesignate.getPrincipals().add(realmPrincipal);
View Full Code Here

                            java.security.Principal p = null;
                            try {
                                Class clazz = Class.forName(principal.getClass1());
                                Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
                                p = (java.security.Principal) constructor.newInstance(new Object[]{principal.getName()});
                                set.add(new RealmPrincipal(realm.getRealmName(), p));
                            } catch (InstantiationException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (IllegalAccessException e) {
                                throw new GeronimoSecurityException(e);
                            } catch (ClassNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.RealmPrincipal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.