Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.Credential


     * @param accreditable An accreditable.
     * @param role
     * @return A credential.
     */
    public Credential getCredential(Accreditable accreditable, Role role) {
        Credential credential = null;
        for (Iterator i = this.credentials.iterator(); i.hasNext();) {
            Credential cred = (Credential) i.next();
            if (cred.getAccreditable().equals(accreditable) && cred.getRole().equals(role)) {
                credential = cred;
            }
        }
        return credential;
    }
View Full Code Here


     *         accreditable.
     */
    public void removeRoles(Accreditable accreditable) throws AccessControlException {
        Credential[] credentials = getCredentials();
        for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
            Credential credential = credentials[credIndex];
            if (credential.getAccreditable().equals(accreditable)) {
                this.credentials.remove(credential);
            }
        }
    }
View Full Code Here

    public Credential[] getCredentials(Identity identity) throws AccessControlException {
        Accreditable[] accreditables = identity.getAccreditables();
        Credential[] credentials = getCredentials();
        Set returnCredential = new LinkedHashSet();
        for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
            Credential credential = credentials[credIndex];
            for (int accrIndex = 0; accrIndex < accreditables.length; accrIndex++) {
                Accreditable accreditable = accreditables[accrIndex];
                if (credential.getAccreditable().equals(accreditable)) {
                    returnCredential.add(credential);
                }
            }
        }
        return (Credential[]) returnCredential.toArray(new Credential[returnCredential.size()]);
View Full Code Here

        moveRole(accreditable, role, true);
    }

    private void moveRole(Accreditable accreditable, Role role, boolean down) {

        Credential cred = getCredential(accreditable, role);
        int position = this.credentials.indexOf(cred);

        if (!down && position > 0) {
            this.credentials.remove(cred);
            this.credentials.add(position - 1, cred);
View Full Code Here

        Accreditable[] accreditables = identity.getAccreditables();
        Credential[] credentials = getCredentials();
        Set returnCredential = new LinkedHashSet();

        for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
            Credential credential = credentials[credIndex];
           
            for (int accrIndex = 0; accrIndex < accreditables.length; accrIndex++) {
                Accreditable accreditable = accreditables[accrIndex];

                if (credential.getAccreditable().equals(accreditable)) {
                    returnCredential.add(credential);
                }
            }
        }
View Full Code Here

    public boolean equals(Object obj) {
        if (!getClass().isInstance(obj)) {
            return false;
        }
        Credential cred = (Credential) obj;
        return cred.getAccreditable().equals(getAccreditable()) && cred.getRole().equals(getRole());
    }
View Full Code Here

                throw new ProcessingException(
                        "AccessControlException - receiving credential failed: ", e);
            }
        }
        for (Iterator i = policyCredentials.iterator(); i.hasNext();) {
            Credential credential = (Credential) i.next();
            Accreditable accreditable = credential.getAccreditable();
            Role role = credential.getRole();
            String method = credential.getMethod();
            credentials.add(new CredentialWrapper(accreditable, role, method));
        }
        return (CredentialWrapper[]) credentials.toArray(new CredentialWrapper[credentials.size()]);
    }
View Full Code Here

     * @param accreditable An accreditable.
     * @param role
     * @return A credential.
     */
    public Credential getCredential(Accreditable accreditable, Role role) {
        Credential credential = null;
        for (Iterator i = this.credentials.iterator(); i.hasNext();) {
            Credential cred = (Credential) i.next();
            if (cred.getAccreditable().equals(accreditable) && cred.getRole().equals(role)) {
                credential = cred;
            }
        }
        return credential;
    }
View Full Code Here

     *         accreditable.
     */
    public void removeRoles(Accreditable accreditable) throws AccessControlException {
        Credential[] credentials = getCredentials();
        for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
            Credential credential = credentials[credIndex];
            if (credential.getAccreditable().equals(accreditable)) {
                this.credentials.remove(credential);
            }
        }
    }
View Full Code Here

    public Credential[] getCredentials(Identity identity) throws AccessControlException {
        Accreditable[] accreditables = identity.getAccreditables();
        Credential[] credentials = getCredentials();
        Set returnCredential = new LinkedHashSet();
        for (int credIndex = 0; credIndex < credentials.length; credIndex++) {
            Credential credential = credentials[credIndex];
            for (int accrIndex = 0; accrIndex < accreditables.length; accrIndex++) {
                Accreditable accreditable = accreditables[accrIndex];
                if (credential.getAccreditable().equals(accreditable)) {
                    returnCredential.add(credential);
                }
            }
        }
        return (Credential[]) returnCredential.toArray(new Credential[returnCredential.size()]);
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.Credential

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.