Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.IdentificationPrincipal


        context.login();
        Subject subject = context.getSubject();

        assertTrue("expected non-null subject", subject != null);
        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);
View Full Code Here


                PassthroughDownPacket passthroughPacket = new PassthroughDownPacket();
                passthroughPacket.setBuffers(packet.getBuffers());

                getDownProtocol().sendDown(passthroughPacket);
            } else {
                IdentificationPrincipal principal = (IdentificationPrincipal) principals.iterator().next();

                SubjectCaryingDownPacket subjectPacket = new SubjectCaryingDownPacket();
                subjectPacket.setSubjectId(principal.getId());
                subjectPacket.setBuffers(packet.getBuffers());

                getDownProtocol().sendDown(subjectPacket);
            }
        }
View Full Code Here

        ContextManager.registerSubject(subject);

        SubjectId id = ContextManager.getSubjectId(lm.getSubject());

        subject.getPrincipals().add(new IdentificationPrincipal(id));

        return true;
    }
View Full Code Here

        context.login();
        Subject subject = context.getSubject();

        assertTrue("expected non-null subject", subject != null);
        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);
View Full Code Here

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

        context.logout();
    }
View Full Code Here

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

        Thread.sleep(20 * 1000);

        try {
            context.logout();
            fail("The login module should have expired");
        } catch (ExpiredLoginModuleException e) {
            context.login();

            subject = context.getSubject();

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

            context.logout();
        }
    }
View Full Code Here

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

        context.logout();
        context.login();
        context.logout();

        /**
         * Waiting this long should cause the login module w/ an artificially
         * low age limit to expire.  The next call to login should automatically
         * create a new one.
         */
        Thread.sleep(4 * 1000);

        context.login();

        subject = context.getSubject();

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

        context.logout();
    }
View Full Code Here

        context.login();
        Subject subject = context.getSubject();

        assertTrue("expected non-null subject", subject != null);
        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);
View Full Code Here

        context.login();
        Subject subject = context.getSubject();

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

        context.logout();
    }
View Full Code Here

                PassthroughDownPacket passthroughPacket = new PassthroughDownPacket();
                passthroughPacket.setBuffers(packet.getBuffers());

                getDownProtocol().sendDown(passthroughPacket);
            } else {
                IdentificationPrincipal principal = (IdentificationPrincipal) principals.iterator().next();

                SubjectCaryingDownPacket subjectPacket = new SubjectCaryingDownPacket();
                subjectPacket.setSubjectId(principal.getId());
                subjectPacket.setBuffers(packet.getBuffers());

                getDownProtocol().sendDown(subjectPacket);
            }
        }
View Full Code Here

TOP

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

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.