Package org.apache.geronimo.security.jaas

Examples of org.apache.geronimo.security.jaas.NamedUsernamePasswordCredential


    }
    public void testParsingTwo() throws Exception {
        loginModule.parseCredentials("foo:bar=baz,foo2:bar2=baz2", passwordCredentials);
        assertEquals(2, passwordCredentials.size());
        Iterator<NamedUsernamePasswordCredential> iterator = passwordCredentials.iterator();
        NamedUsernamePasswordCredential cred = iterator.next();
        checkCredential(cred, "foo", "bar", "baz");
        cred = iterator.next();
        checkCredential(cred, "foo2", "bar2", "baz2");
    }
View Full Code Here


        Matcher matcher = pattern.matcher(unparsedCredentials);
        while (matcher.find()) {
            String credentialName = matcher.group(1);
            String credentialUser = matcher.group(2);
            String credentialPassword = matcher.group(3);
            NamedUsernamePasswordCredential credential = new NamedUsernamePasswordCredential(credentialUser, credentialPassword.toCharArray(), credentialName);
            passwordCredentials.add(credential);
        }
    }
View Full Code Here

                throw new IllegalStateException("Subject missing but authentication turned on");
            } else {
                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
                boolean found = false;
                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
                        call.setUsername(namedUsernamePasswordCredential.getUsername());
                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
                        found = true;
                        break;
                    }
                }
                if (!found) {
View Full Code Here

    }

    public void testParsingOne() throws Exception {
        loginModule.parseCredentials("foo:bar=baz", passwordCredentials);
        assertEquals(1, passwordCredentials.size());
        NamedUsernamePasswordCredential cred = passwordCredentials.iterator().next();
        checkCredential(cred, "foo", "bar", "baz");
    }
View Full Code Here

    }
    public void testParsingTwo() throws Exception {
        loginModule.parseCredentials("foo:bar=baz,foo2:bar2=baz2", passwordCredentials);
        assertEquals(2, passwordCredentials.size());
        Iterator<NamedUsernamePasswordCredential> iterator = passwordCredentials.iterator();
        NamedUsernamePasswordCredential cred = iterator.next();
        checkCredential(cred, "foo", "bar", "baz");
        cred = iterator.next();
        checkCredential(cred, "foo2", "bar2", "baz2");
    }
View Full Code Here

        GerNamedUsernamePasswordCredentialType[] namedCredentials = defaultPrincipalType.getNamedUsernamePasswordCredentialArray();
        if (namedCredentials.length > 0) {
            Set defaultCredentialSet = new HashSet();
            for (int i = 0; i < namedCredentials.length; i++) {
                GerNamedUsernamePasswordCredentialType namedCredentialType = namedCredentials[i];
                NamedUsernamePasswordCredential namedCredential = new NamedUsernamePasswordCredential(namedCredentialType.getUsername().trim(), namedCredentialType.getPassword().trim().toCharArray(), namedCredentialType.getName().trim());
                defaultCredentialSet.add(namedCredential);
            }
            defaultPrincipal.setNamedUserPasswordCredentials(defaultCredentialSet);
        }
        return defaultPrincipal;
View Full Code Here

                throw new IllegalStateException("Subject missing but authentication turned on");
            } else {
                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
                boolean found = false;
                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
                        call.setUsername(namedUsernamePasswordCredential.getUsername());
                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
                        found = true;
                        break;
                    }
                }
                if (!found) {
View Full Code Here

        GerNamedUsernamePasswordCredentialType[] namedCredentials = defaultPrincipalType.getNamedUsernamePasswordCredentialArray();
        if (namedCredentials.length > 0) {
            Set defaultCredentialSet = new HashSet();
            for (int i = 0; i < namedCredentials.length; i++) {
                GerNamedUsernamePasswordCredentialType namedCredentialType = namedCredentials[i];
                NamedUsernamePasswordCredential namedCredential = new NamedUsernamePasswordCredential(namedCredentialType.getUsername().trim(), namedCredentialType.getPassword().trim().toCharArray(), namedCredentialType.getName().trim());
                defaultCredentialSet.add(namedCredential);
            }
            defaultPrincipal.setNamedUserPasswordCredentials(defaultCredentialSet);
        }
        return defaultPrincipal;
View Full Code Here

                throw new IllegalStateException("Subject missing but authentication turned on");
            } else {
                Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
                boolean found = false;
                for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
                    NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
                    if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
                        call.setUsername(namedUsernamePasswordCredential.getUsername());
                        call.setPassword(new String(namedUsernamePasswordCredential.getPassword()));
                        found = true;
                        break;
                    }
                }
                if (!found) {
View Full Code Here

    }

    public void testParsingOne() throws Exception {
        loginModule.parseCredentials("foo:bar=baz", passwordCredentials);
        assertEquals(1, passwordCredentials.size());
        NamedUsernamePasswordCredential cred = passwordCredentials.iterator().next();
        checkCredential(cred, "foo", "bar", "baz");
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.jaas.NamedUsernamePasswordCredential

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.