All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.caelum.brutauth.verifier.GenericRulesVerifier Maven / Gradle / Ivy

There is a newer version: 4.0.4
Show newest version
package br.com.caelum.brutauth.verifier;

import javax.inject.Inject;

import br.com.caelum.brutauth.auth.rules.BrutauthRule;
import br.com.caelum.brutauth.reflection.Argument;
import br.com.caelum.vraptor.ioc.Container;

/**
 * Verifies if one of the rules of the annotated type returns false
 * 
 * @author Leonardo Wolter
 *
 */
public class GenericRulesVerifier {

	private Container container;
	private SingleRuleVerifier verifier;

	@Inject
	public GenericRulesVerifier(Container container, SingleRuleVerifier verifier) {
				this.container = container;
				this.verifier = verifier;
	}
	
	public boolean verify(Class[] rules, Argument[] arguments) {
		for (Class rule : rules) {
			BrutauthRule brutauthRule = container.instanceFor(rule);
			if(!verifier.verify(brutauthRule, arguments)) return false;
		}
		return true;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy