restx.security.DefaultCookieSignerFactoryMachine Maven / Gradle / Ivy
package restx.security;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.security.DefaultCookieSigner;
@Machine
public class DefaultCookieSignerFactoryMachine extends SingleNameFactoryMachine {
public static final Name NAME = Name.of(restx.security.DefaultCookieSigner.class, "CookieSigner");
public DefaultCookieSignerFactoryMachine() {
super(0, new StdMachineEngine(NAME, 0, BoundlessComponentBox.FACTORY) {
private final Factory.Query signatureKey = Factory.Query.byClass(restx.security.SignatureKey.class).optional();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
signatureKey
));
}
@Override
protected restx.security.DefaultCookieSigner doNewComponent(SatisfiedBOM satisfiedBOM) {
return new DefaultCookieSigner(
satisfiedBOM.getOneAsComponent(signatureKey)
);
}
});
}
}