restx.security.SecurityFactoryFactoryMachine Maven / Gradle / Ivy
package restx.security;
import com.google.common.collect.ImmutableSet;
import restx.factory.*;
import restx.security.SecurityFactory;
@Machine
public class SecurityFactoryFactoryMachine extends DefaultFactoryMachine {
private static final SecurityFactory module = new SecurityFactory();
public SecurityFactoryFactoryMachine() {
super(1000, new MachineEngine[] {
new StdMachineEngine(Name.of(restx.security.RestxSessionCookieDescriptor.class, "restxSessionCookieDescriptor"), 1000, BoundlessComponentBox.FACTORY) {
private final Factory.Query appName = Factory.Query.byName(Name.of(java.lang.String.class, "app.name")).optional();
private final Factory.Query restxConfig = Factory.Query.byClass(restx.common.RestxConfig.class).mandatory();
@Override
public BillOfMaterials getBillOfMaterial() {
return new BillOfMaterials(ImmutableSet.>of(
appName,
restxConfig
));
}
@Override
public restx.security.RestxSessionCookieDescriptor doNewComponent(SatisfiedBOM satisfiedBOM) {
return module.restxSessionCookieDescriptor(
satisfiedBOM.getOneAsComponent(appName),
satisfiedBOM.getOne(restxConfig).get().getComponent()
);
}
},
});
}
}