Package org.apache.geronimo.security.realm.providers

Examples of org.apache.geronimo.security.realm.providers.GeronimoPasswordCredential


        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 1, subject.getPrivateCredentials().size());
        assertEquals("GeronimoPasswordCredential private credentials", 1, subject.getPrivateCredentials(GeronimoPasswordCredential.class).size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertEquals("Username", username, pwdCred.getUserName());
        assertEquals("Password", password, new String(pwdCred.getPassword()));

        context.logout();

        assertEquals("Private credentials upon logout", 0, subject.getPrivateCredentials().size());
        assertTrue("id of server subject should be null", ContextManager.getSubjectId(subject) == null);
View Full Code Here


        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertTrue("credential should have been destroyed", pwdCred.isDestroyed());
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 1, subject.getPrivateCredentials().size());
        assertEquals("GeronimoPasswordCredential private credentials", 1, subject.getPrivateCredentials(GeronimoPasswordCredential.class).size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertEquals("Username", username, pwdCred.getUserName());
        assertEquals("Password", password, new String(pwdCred.getPassword()));

        context.logout();

        assertEquals("Private credentials upon logout", 0, subject.getPrivateCredentials().size());
        assertTrue("id of server subject should be null", ContextManager.getSubjectId(subject) == null);
View Full Code Here

        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertTrue("credential should have been destroyed", pwdCred.isDestroyed());
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 1, subject.getPrivateCredentials().size());
        assertEquals("GeronimoPasswordCredential private credentials", 1, subject.getPrivateCredentials(GeronimoPasswordCredential.class).size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertEquals("Username", username, pwdCred.getUserName());
        assertEquals("Password", password, new String(pwdCred.getPassword()));

        context.logout();

        assertEquals("Private credentials upon logout", 0, subject.getPrivateCredentials().size());
        assertTrue("id of server subject should be null", ContextManager.getSubjectId(subject) == null);
View Full Code Here

        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertTrue("credential should have been destroyed", pwdCred.isDestroyed());
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 1, subject.getPrivateCredentials().size());
        assertEquals("GeronimoPasswordCredential private credentials", 1, subject.getPrivateCredentials(GeronimoPasswordCredential.class).size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertEquals("Username", username, pwdCred.getUserName());
        assertEquals("Password", password, new String(pwdCred.getPassword()));

        context.logout();

        assertEquals("Private credentials upon logout", 0, subject.getPrivateCredentials().size());
        assertTrue("id of server subject should be null", ContextManager.getSubjectId(subject) == null);
View Full Code Here

        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertTrue("credential should have been destroyed", pwdCred.isDestroyed());
    }
View Full Code Here

        return resourcePrincipalName != null && userName != null && password != null;
    }

    public boolean commit() throws LoginException {
        subject.getPrincipals().add(new TestPrincipal(resourcePrincipalName));
        GeronimoPasswordCredential passwordCredential = new GeronimoPasswordCredential(userName, password);
        subject.getPrivateCredentials().add(passwordCredential);
        return true;
    }
View Full Code Here

            public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
                Set credentials = sourceSubject.getPrivateCredentials(GeronimoPasswordCredential.class);
                if (credentials == null || credentials.size() != 1) {
                    throw new UnsupportedCallbackException(null, "No GeronimoPasswordCredential to read");
                }
                GeronimoPasswordCredential geronimoPasswordCredential = (GeronimoPasswordCredential) credentials.iterator().next();
                for (int i = 0; i < callbacks.length; i++) {
                    Callback callback = callbacks[i];
                    if (callback instanceof NameCallback) {
                        ((NameCallback) callback).setName(geronimoPasswordCredential.getUserName());
                    } else if (callback instanceof PasswordCallback) {
                        ((PasswordCallback) callback).setPassword(geronimoPasswordCredential.getPassword());
                    } else {
                        throw new UnsupportedCallbackException(callback, "Only name and password callbacks supported");
                    }

                }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.realm.providers.GeronimoPasswordCredential

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.