
net.unicon.cas.mfa.authentication.principal.ChainingCredentialsToPrincipalResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cas-mfa-java Show documentation
Show all versions of cas-mfa-java Show documentation
This module is intended to include all the Java you need to add to a CAS implementation
to take advantage of the extended multifactor authentication features in this project.
package net.unicon.cas.mfa.authentication.principal;
import org.jasig.cas.authentication.principal.Credentials;
import org.jasig.cas.authentication.principal.CredentialsToPrincipalResolver;
import org.jasig.cas.authentication.principal.Principal;
import java.util.Iterator;
import java.util.List;
/**
* This is {@link ChainingCredentialsToPrincipalResolver} that chains a number of
* principal resolvers together.
*
* @author Misagh Moayyed
*/
public final class ChainingCredentialsToPrincipalResolver implements CredentialsToPrincipalResolver {
private List chain;
@Override
public Principal resolvePrincipal(final Credentials credentials) {
final Iterator it = this.chain.iterator();
while (it.hasNext()) {
final CredentialsToPrincipalResolver resolver = it.next();
if (resolver.supports(credentials)) {
final Principal p = resolver.resolvePrincipal(credentials);
if (p != null) {
return p;
}
}
}
return null;
}
@Override
public boolean supports(final Credentials credentials) {
return true;
}
public void setChain(final List chain) {
this.chain = chain;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy