SectionFunction handler = namespace.addSectionFunction("handler", "handler"); handler.getFunctionObject(Dependencies.AUTHENTICATION_REQUIRED_EXCEPTION.name()).flagAsParameter(); designer.link(handler.getFunctionObject(Dependencies.SERVER_HTTP_CONNECTION.name()), serverHttpConnection); SectionFunction sender = namespace.addSectionFunction("sender", "sender"); designer.link(sender.getFunctionObject( net.officefloor.web.security.impl.SendHttpChallengeFunction.Dependencies.HTTP_CHALLENGE_CONTEXT.name()),
SectionFunctionNamespace initialNamespace = designer.addSectionFunctionNamespace("INITIAL", new WebTemplateInitialManagedFunctionSource(initialFunctionFactory)); SectionFunction initialFunction = initialNamespace.addSectionFunction("_INITIAL_FUNCTION_", WebTemplateInitialManagedFunctionSource.FUNCTION_NAME); designer.link(initialFunction.getFunctionObject("SERVER_HTTP_CONNECTION"), connectionObject); new WebTemplateManagedFunctionSource(isTemplateSecure, template, templateCharset, linkSeparatorCharacter)); templateNamespace.addProperty(PROPERTY_TEMPLATE_CONTENT, templateContent); SectionFunction templateFunction = templateNamespace.addSectionFunction(templateFunctionName, templateFunctionName); templateNamespace.addProperty(PROPERTY_BEAN_PREFIX + templateFunctionName, beanType.getName()); templateFunctionName + "ArrayIterator", new WebTemplateArrayIteratorManagedFunctionSource(beanType)); SectionFunction arrayIteratorFunction = arrayIteratorNamespace.addSectionFunction( templateFunctionName + "ArrayIterator", WebTemplateArrayIteratorManagedFunctionSource.FUNCTION_NAME); SectionFunction completeFunction = designer .addSectionFunctionNamespace("", new WebTemplateArrayIteratorCompletionManagedObjectSource()) .addSectionFunction("_complete_array_iteration_", WebTemplateArrayIteratorCompletionManagedObjectSource.FUNCTION_NAME); designer.link(
SectionFunction challengeFunction = namespace.addSectionFunction( HttpSecurityManagedFunctionSource.FUNCTION_CHALLENGE, HttpSecurityManagedFunctionSource.FUNCTION_CHALLENGE); SectionFunction moAuthFunction = namespace.addSectionFunction( HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_AUTHENTICATE, HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_AUTHENTICATE); SectionFunction moLogoutFunction = namespace.addSectionFunction( HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_LOGOUT, HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_LOGOUT); SectionFunction startAuthFunction = namespace.addSectionFunction( HttpSecurityManagedFunctionSource.FUNCTION_START_APPLICATION_AUTHENTICATE, HttpSecurityManagedFunctionSource.FUNCTION_START_APPLICATION_AUTHENTICATE); SectionFunction completeAuthFunction = namespace.addSectionFunction( HttpSecurityManagedFunctionSource.FUNCTION_COMPLETE_APPLICATION_AUTHENTICATE, HttpSecurityManagedFunctionSource.FUNCTION_COMPLETE_APPLICATION_AUTHENTICATE);
@Override public SectionFlowSinkNode secureFlow(SectionDesigner designer, Class<?> argumentType, SectionFlowSinkNode secureFlowSink, SectionFlowSinkNode insecureFlowSink) { // Create the annotation HttpFlowSecurerAnnotation annotation = new HttpFlowSecurerAnnotation( this.httpSecurerBuilder.getHttpSecurityName(), this.httpSecurerBuilder.getAnyRoles(), this.httpSecurerBuilder.getRequiredRoles(), argumentType); // Configure the function String functionName = HttpSecurityArchitectEmployer.this.nextUniqueName(); SectionFunctionNamespace namespace = designer.addSectionFunctionNamespace(functionName, new HttpFlowSecurerManagedFunctionSource(annotation)); SectionFunction function = namespace.addSectionFunction(functionName, HttpFlowSecurerManagedFunctionSource.FUNCTION_NAME); // Configure the function designer.link(function.getFunctionFlow(Flows.SECURE.name()), secureFlowSink, false); designer.link(function.getFunctionFlow(Flows.INSECURE.name()), insecureFlowSink, false); // Return the decision flow sink return function; } }
@Override public void sourceSection(SectionDesigner designer, SectionSourceContext context) throws Exception { SectionFunctionNamespace namespace = designer.addSectionFunctionNamespace("secure", new HttpFlowSecurerManagedFunctionSource(this.annotation)); SectionFunction function = namespace.addSectionFunction("secure", HttpFlowSecurerManagedFunctionSource.FUNCTION_NAME); designer.link(designer.addSectionInput(INPUT_NAME, null), function); designer.link(function.getFunctionFlow(Flows.SECURE.name()), designer.addSectionOutput(SECURE_OUTPUT_NAME, null, false), false); designer.link(function.getFunctionFlow(Flows.INSECURE.name()), designer.addSectionOutput(INSECURE_OUTPUT_NAME, null, false), false); } }
SectionFunction route = routeNamespace.addSectionFunction(WebArchitect.HANDLER_INPUT_NAME, ROUTE_FUNCTION_NAME); SectionFunction handleRedirect = handleRedirectNamespace.addSectionFunction(HANDLE_REDIRECT_FUNCTION_NAME, HANDLE_REDIRECT_FUNCTION_NAME); SectionFunction intercept = interceptNamespace.addSectionFunction( InterceptManagedFunctionSource.FUNCTION_NAME, InterceptManagedFunctionSource.FUNCTION_NAME); designer.link(handleHttpInput, intercept); SectionFunction initialise = initialiseNamespace.addSectionFunction(outputName, INITIALISE_REQUEST_STATE_FUNCTION_NAME); designer.link(routeFlow, initialise, false); SectionFunctionNamespace notFoundNamespace = designer.addSectionFunctionNamespace("NOT_FOUND", new NotFoundManagedFunctionSource()); SectionFunction notFound = notFoundNamespace.addSectionFunction(NOT_FOUND_INPUT_NAME, NOT_FOUND_INPUT_NAME); designer.link(notFoundInput, notFound); SectionFunction redirection = redirectNamespace.addSectionFunction(functionName, functionName);