/*******************************************************************************
*******************************************************************************/
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.api.idp.process.Task;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
/**
* A dummy task simulating the validation of an auth block.
*
* Requires context data:
*
* - {@code IdentityLink}
* - {@code isIdentityLinkValidated}
* - {@code SignedAuthBlock}
*
*
*
* Enriches context data with:
*
* - {@code isSignedAuthBlockValidated}
*
*
*
* @author tknall
*
*/
@Service("ValidateSignedAuthBlockTask")
public class ValidateSignedAuthBlockTask implements Task {
private Logger log = LoggerFactory.getLogger(getClass());
@Override
public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException {
Objects.requireNonNull(executionContext.get("IdentityLink"));
assert (Boolean.TRUE.equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
Objects.requireNonNull(executionContext.get("SignedAuthBlock"));
log.debug("Using validated IdentityLink and signed auth block in order to validate signed auth block.");
executionContext.put("isSignedAuthBlockValidated", true);
return null;
}
}