@Override public OfficeSectionInput getAuthenticateInput() { return this.section.getOfficeSectionInput(HttpSecuritySectionSource.INPUT_AUTHENTICATE); }
@Override public OfficeSectionOutput getOutput(String outputName) { return this.section.getOfficeSectionOutput(outputName); }
@Override public WebTemplate addGovernance(OfficeGovernance governance) { this.section.addGovernance(governance); return this; } }
@Override public OfficeFlowSinkNode secureFlow(Class<?> argumentType, OfficeFlowSinkNode secureFlowSink, OfficeFlowSinkNode insecureFlowSink) { // Obtain the office architect OfficeArchitect office = HttpSecurityArchitectEmployer.this.officeArchitect; // Create the section to handle access logic String sectionName = HttpSecurityArchitectEmployer.this.nextUniqueName(); OfficeSection section = office.addOfficeSection(sectionName, new HttpFlowSecurerSectionSource( new HttpFlowSecurerAnnotation(qualifier, anyRoles, allRoles, argumentType)), null); // Link office.link(section.getOfficeSectionOutput(HttpFlowSecurerSectionSource.SECURE_OUTPUT_NAME), secureFlowSink); office.link(section.getOfficeSectionOutput(HttpFlowSecurerSectionSource.INSECURE_OUTPUT_NAME), insecureFlowSink); // Return the sink to secure flow decision return section.getOfficeSectionInput(HttpFlowSecurerSectionSource.INPUT_NAME); } });
new HandleAuthenticationRequiredSectionSource(httpSecurityNames, negotiator), null); this.officeArchitect.link( handleAuthenticationRequiredSection.getOfficeSectionObject(HttpChallengeContext.class.getSimpleName()), httpChallengeContext); this.officeArchitect.link(authenticationRequiredEscalation, handleAuthenticationRequiredSection .getOfficeSectionInput(HandleAuthenticationRequiredSectionSource.HANDLE_INPUT)); for (HttpSecurityBuilderImpl<?, ?, ?, ?, ?> security : this.securities) { this.officeArchitect.link(handleAuthenticationRequiredSection.getOfficeSectionOutput(security.name), security.section.getOfficeSectionInput(HttpSecuritySectionSource.INPUT_CHALLENGE));
sections.linkToSectionInput(() -> section.getOfficeSectionOutput(outputName), outputModel.getWoofSectionInput(), (link) -> link.getWoofSectionInput()); templates.linkToTemplate(() -> section.getOfficeSectionOutput(outputName), outputModel.getWoofTemplate(), (link) -> link.getWoofTemplate(), outputArgumentTypeName); securities.linkToSecurity(() -> section.getOfficeSectionOutput(outputName), outputModel.getWoofSecurity(), (link) -> link.getWoofSecurity()); resources.linkToResource(() -> section.getOfficeSectionOutput(outputName), outputModel.getWoofResource(), (link) -> link.getWoofResource()); httpContinuations.linkToHttpContinuation(() -> section.getOfficeSectionOutput(outputName), outputModel.getWoofHttpContinuation(), (link) -> link.getWoofHttpContinuation(), outputArgumentTypeName); section.addGovernance(governance);
/** * Instantiate. * * @param woof {@link WoofModel}. * @param officeArchitect {@link OfficeArchitect}. */ private SectionConnector(WoofModel woof, OfficeArchitect officeArchitect) { this.officeArchitect = officeArchitect; // Configure the sections for (WoofSectionModel sectionModel : woof.getWoofSections()) { // Obtain the section details String sectionName = sectionModel.getWoofSectionName(); String sectionSourceClassName = sectionModel.getSectionSourceClassName(); String sectionLocation = sectionModel.getSectionLocation(); // Configure the section OfficeSection section = officeArchitect.addOfficeSection(sectionName, sectionSourceClassName, sectionLocation); for (PropertyModel property : sectionModel.getProperties()) { section.addProperty(property.getName(), property.getValue()); } // Maintain reference to section by name this.sections.put(sectionName, section); // Maintain references from inputs to section for (WoofSectionInputModel inputModel : sectionModel.getInputs()) { this.inputToSection.put(inputModel, sectionModel); } } }
OfficeSectionInput linkInput = this.section.getOfficeSectionInput(linkName); .getOfficeSectionOutput(outputType.getOfficeSectionOutputName()); WebTemplateArchitectEmployer.this.officeArchitect.link(redirectOutput, this.templateInput.getRedirect(valuesType == null ? null : valuesType.getName()));
authenticationContextMos.setTimeout(this.timeout); office.link(authenticationContextMos.getOfficeManagedObjectFlow("AUTHENTICATE"), this.section.getOfficeSectionInput("ManagedObjectAuthenticate")); office.link(authenticationContextMos.getOfficeManagedObjectFlow("LOGOUT"), this.section.getOfficeSectionInput("ManagedObjectLogout")); OfficeManagedObject authenticationContext = authenticationContextMos .addOfficeManagedObject(authenticationContextName, ManagedObjectScope.PROCESS); office.link(this.section.getOfficeSectionObject(AuthenticationContext.class.getSimpleName()), authenticationContext); office.link(this.section.getOfficeSectionObject("AccessControl"), accessControl); if (credentialsType != null) { HttpSecurityArchitectEmployer.this.webArchitect .reroute(this.section.getOfficeSectionOutput(HttpSecuritySectionSource.OUTPUT_RECONTINUE));
.getOfficeSectionOutput(interception.getOutputName()); for (Interceptor interceptor : this.interceptors) { OfficeSectionInput routingInput = this.routingSection.getOfficeSectionInput(interception.getInputName()); this.officeArchitect.link(interceptionOutput, routingInput); .getOfficeSectionOutput(HttpRouteSectionSource.UNHANDLED_OUTPUT_NAME); NEXT_CHAINED_SERVICER: for (ChainedServicer servicer : this.chainedServicers) { this.routingSection.getOfficeSectionInput(HttpRouteSectionSource.NOT_FOUND_INPUT_NAME));
@Override public void reroute(OfficeFlowSourceNode flowSourceNode) { this.officeArchitect.link(flowSourceNode, this.routingSection.getOfficeSectionInput(HANDLER_INPUT_NAME)); }
@Override public OfficeFlowSourceNode getOutput(String outputName) { return this.section.getOfficeSectionOutput(outputName); }
/** * Link to {@link OfficeSectionInput}. * * @param flowSourceFactory {@link Supplier} of the * {@link OfficeFlowSourceNode}. * @param connectionModel {@link ConnectionModel} to * {@link OfficeSectionInputModel}. * @param sectionInputFactory Factory to extract {@link OfficeSectionInputModel} * from {@link ConnectionModel}. */ private <C extends ConnectionModel> void linkToSectionInput(Supplier<OfficeFlowSourceNode> flowSourceFactory, C connectionModel, Function<C, WoofSectionInputModel> sectionInputFactory) { // Determine if linking if (connectionModel != null) { WoofSectionInputModel sectionInput = sectionInputFactory.apply(connectionModel); if (sectionInput != null) { // Obtain target input name String targetInputName = sectionInput.getWoofSectionInputName(); // Obtain the target section WoofSectionModel sectionModel = this.inputToSection.get(sectionInput); OfficeSection targetSection = this.sections.get(sectionModel.getWoofSectionName()); // Link the flow to the section input this.officeArchitect.link(flowSourceFactory.get(), targetSection.getOfficeSectionInput(targetInputName)); } } } }
/** * Instantiate. * * @param isSecure * Indicates if secure. * @param httpMethod * {@link HttpMethod}. * @param applicationPath * Application path. */ private HttpInputImpl(boolean isSecure, HttpMethod httpMethod, String applicationPath) { this.isSecure = isSecure; this.httpMethod = httpMethod; this.applicationPath = applicationPath; this.routeInput = WebArchitectEmployer.this.routing.addRoute(isSecure, this.httpMethod, this.applicationPath); this.input = WebArchitectEmployer.this.routingSection .getOfficeSectionOutput(this.routeInput.getOutputName()); }
@Override public HttpInput link(boolean isSecure, String httpMethodName, String applicationPath, Class<?> sectionClass) { // Add the section OfficeSection section = this.addSection(httpMethodName + "_" + applicationPath, sectionClass); // Create the link to the section service method HttpInput input = this.webArchitect.getHttpInput(isSecure, httpMethodName, applicationPath); this.officeArchitect.link(input.getInput(), section.getOfficeSectionInput("service")); return input; }
@Override public HttpUrlContinuation link(boolean isSecure, String applicationPath, Class<?> sectionClass) { // Add the section OfficeSection section = this.addSection("GET_" + applicationPath, sectionClass); // Return the link to the section service method HttpUrlContinuation continuation = this.webArchitect.getHttpInput(isSecure, applicationPath); this.officeArchitect.link(continuation.getInput(), section.getOfficeSectionInput("service")); return continuation; } }
/** * Instantiate. * * @param isSecure * Indicates if requires secure {@link ServerHttpConnection} to * render the {@link WebTemplate}. * @param applicationPath * Application path for the {@link WebTemplate}. * @param webTemplateSectionSource * {@link WebTemplateSectionSource}. * @param templateSection * {@link OfficeSection} for the {@link WebTemplate}. * @param properties * {@link PropertyList}. */ private WebTemplateImpl(boolean isSecure, String applicationPath, WebTemplateSectionSource webTemplateSectionSource, OfficeSection templateSection, PropertyList properties) { super(webTemplateSectionSource, isSecure, applicationPath, properties, WebTemplateArchitectEmployer.this.officeArchitect); this.section = templateSection; // Configure the input this.sectionInput = this.section.getOfficeSectionInput(WebTemplateSectionSource.RENDER_TEMPLATE_INPUT_NAME); this.templateInput = WebTemplateArchitectEmployer.this.webArchitect.getHttpInput(isSecure, applicationPath); WebTemplateArchitectEmployer.this.officeArchitect.link(this.templateInput.getInput(), this.sectionInput); }
@Override public OfficeFlowSinkNode getRedirect(String parameterTypeName) { // Obtain the parameter type class Class<?> parameterType = CompileUtil.isBlank(parameterTypeName) ? Object.class : WebArchitectEmployer.this.officeSourceContext.loadClass(parameterTypeName); // Determine if already cached OfficeFlowSinkNode flowSinkNode = this.redirects.get(parameterTypeName); if (flowSinkNode != null) { return flowSinkNode; } // Not cached, so create try { // Create the redirect Redirect redirect = WebArchitectEmployer.this.routing.addRedirect(this.isSecure, this.routeInput, parameterType); // Obtain and cache the flow sink node for the redirect flowSinkNode = WebArchitectEmployer.this.routingSection.getOfficeSectionInput(redirect.getInputName()); this.redirects.put(parameterTypeName, flowSinkNode); // Return the section input for redirect return flowSinkNode; } catch (Exception ex) { throw WebArchitectEmployer.this.officeArchitect.addIssue("Failed to create redirect to " + this.applicationPath + (parameterTypeName == null ? " with null value type" : " with values type " + parameterTypeName), ex); } } }
architect.getOfficeSection(flow.getSection()).getOfficeSectionInput(flow.getInput()));