Package org.apache.geronimo.security

Examples of org.apache.geronimo.security.RealmPrincipal


    }

    public static RealmPrincipal generateRealmPrincipal(final String realm, final String loginDomain, final String className, final String principalName,
                                                        Bundle bundle)
    {
        return new RealmPrincipal(realm, loginDomain, generatePrincipal(className, principalName, bundle));
    }
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

        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

            assertTrue("id of server-side subject should be non-null", ContextManager.getSubjectId(subject) != null);
            assertEquals("server-side subject should have three principals", 3, subject.getPrincipals().size());
            assertEquals("server-side subject should have one realm principal", 1, subject.getPrincipals(RealmPrincipal.class).size());
            assertEquals("server-side subject should have one identification principal", 1, subject.getPrincipals(IdentificationPrincipal.class).size());
            assertEquals("server-side subject should have one kerberos principal", 1, subject.getPrincipals(KerberosPrincipal.class).size());
            RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();

            context.logout();

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

        Set wrapped = new HashSet();
        for (Iterator iter = localSubject.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

    protected JAASJettyPrincipal generateDefaultPrincipal(Security securityConfig, DefaultPrincipal defaultPrincipal) throws GeronimoSecurityException {
        JAASJettyPrincipal result = new JAASJettyPrincipal("default");
        Subject defaultSubject = new Subject();

        RealmPrincipal realmPrincipal = ConfigurationUtil.generateRealmPrincipal(defaultPrincipal.getPrincipal(), defaultPrincipal.getRealmName());
        if (realmPrincipal == null) {
            throw new GeronimoSecurityException("Unable to create realm principal");
        }
        PrimaryRealmPrincipal primaryRealmPrincipal = ConfigurationUtil.generatePrimaryRealmPrincipal(defaultPrincipal.getPrincipal(), defaultPrincipal.getRealmName());
        if (primaryRealmPrincipal == null) {
View Full Code Here

                    while (principalClasses.hasNext()) {
                        Principal principal = new Principal();
                        principal.setClassName((String) principalClasses.next());
                        principal.setPrincipalName(roleName);

                        RealmPrincipal realmPrincipal = ConfigurationUtil.generateRealmPrincipal(principal, realmName);
                        if (realmPrincipal == null) throw new GeronimoSecurityException("Unable to create realm principal");

                        principalSet.add(realmPrincipal);
                        roleDesignate.getPrincipals().add(realmPrincipal);
                    }
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

            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

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.