new HandleAuthenticationRequiredManagedFunctionSource()); SectionFunction handler = namespace.addSectionFunction("handler", "handler"); handler.getFunctionObject(Dependencies.AUTHENTICATION_REQUIRED_EXCEPTION.name()).flagAsParameter(); designer.link(handler.getFunctionObject(Dependencies.SERVER_HTTP_CONNECTION.name()), serverHttpConnection); designer.link(handler.getFunctionObject(Dependencies.HTTP_SESSION.name()), httpSession); designer.link(handler.getFunctionObject(Dependencies.REQUEST_STATE.name()), requestState); for (String httpSecurityName : this.httpSecurityNames) { FunctionFlow flow = handler.getFunctionFlow(httpSecurityName); designer.link(flow, output, false); designer.link(sender.getFunctionObject( net.officefloor.web.security.impl.SendHttpChallengeFunction.Dependencies.HTTP_CHALLENGE_CONTEXT.name()), httpChallengeContext); designer.link(sender.getFunctionObject( net.officefloor.web.security.impl.SendHttpChallengeFunction.Dependencies.SERVER_HTTP_CONNECTION.name()), serverHttpConnection); designer.link(handler.getFunctionFlow("Send"), sender, false);
@Override protected void enrichFunction(SectionFunction function, ManagedFunctionType<?, ?> functionType, Method method, Class<?> parameterType) { // Do not include if no logic class if (NoLogicClass.class.equals(this.sectionClass)) { return; } // Keep track of the functions to allow linking by case-insensitive // names String functionKey = createFunctionKey(function.getSectionFunctionName()); this.sectionClassMethodFunctionsByName.put(functionKey, new TemplateClassFunction(function, functionType, method, parameterType)); // Enrich the function super.enrichFunction(function, functionType, method, parameterType); }
designer.link(route.getFunctionFlow(HANDLE_REDIRECT_FLOW), handleRedirect, false); FunctionFlow handleRedirectFlow = handleRedirect.getFunctionFlow(outputName); designer.link(handleRedirectFlow, output, false); FunctionFlow routeFlow = route.getFunctionFlow(outputName); if (!routeConfig.inputPath.isPathParameters()) { initialise.getFunctionObject(InitialiseHttpRequestStateDependencies.PATH_ARGUMENTS.name()) .flagAsParameter(); initialise.getFunctionObject(InitialiseHttpRequestStateDependencies.HTTP_REQUEST_STATE.name()), requestState); designer.link(route.getFunctionFlow(UNHANDLED_OUTPUT_NAME), unhandled, false); designer.link(handleRedirect.getFunctionFlow(UNHANDLED_OUTPUT_NAME), unhandled, false); designer.link(notFound.getFunctionEscalation(NotFoundHttpException.class.getName()), notFoundEscalation, true); designer.link(route.getFunctionObject(HttpRouteDependencies.SERVER_HTTP_CONNECTION.name()), serverHttpConnection); handleRedirect.getFunctionObject(HttpHandleRedirectDependencies.COOKIE.name()).flagAsParameter(); designer.link(handleRedirect.getFunctionObject(HttpHandleRedirectDependencies.SERVER_HTTP_CONNECTION.name()), serverHttpConnection); designer.link(handleRedirect.getFunctionObject(HttpHandleRedirectDependencies.REQUEST_STATE.name()), requestState); designer.link(handleRedirect.getFunctionObject(HttpHandleRedirectDependencies.SESSION.name()), session);
@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; } }
SectionFunction initialFunction = initialNamespace.addSectionFunction("_INITIAL_FUNCTION_", WebTemplateInitialManagedFunctionSource.FUNCTION_NAME); designer.link(initialFunction.getFunctionObject("SERVER_HTTP_CONNECTION"), connectionObject); designer.link(initialFunction.getFunctionEscalation(IOException.class.getName()), ioEscalation, false); FunctionFlow templateRedirectFlow = initialFunction.getFunctionFlow(Flows.REDIRECT.name()); String redirectValuesFunctionName = context.getProperty(PROPERTY_REDIRECT_VALUES_FUNCTION, null); SectionFunction redirectValuesFunction = null; designer.link(templateFunction.getFunctionObject("SERVER_HTTP_CONNECTION"), connectionObject); designer.link(templateFunction.getFunctionEscalation(IOException.class.getName()), ioEscalation, false); templateFunction.getFunctionObject("OBJECT").flagAsParameter(); WebTemplateArrayIteratorManagedFunctionSource.FUNCTION_NAME); arrayIteratorFunction .getFunctionObject(WebTemplateArrayIteratorManagedFunctionSource.OBJECT_NAME) .flagAsParameter(); arrayIteratorFunction.getFunctionFlow( WebTemplateArrayIteratorManagedFunctionSource.RENDER_ELEMENT_FLOW_NAME), templateFunction, false); FunctionFlow renderFlow = initialFunction.getFunctionFlow(Flows.RENDER.name()); if (beanFunction != null) { previousTemplateFunction.getFunctionFlow( WebTemplateArrayIteratorManagedFunctionSource.CONTINUE_TEMPLATE_FLOW_NAME),
@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); } }
HttpSecurityManagedFunctionSource.FUNCTION_CHALLENGE, HttpSecurityManagedFunctionSource.FUNCTION_CHALLENGE); designer.link(challengeFunction.getFunctionObject(HttpChallengeContext.class.getSimpleName()), httpChallengeContext); designer.link(challengeFunction.getFunctionObject(ServerHttpConnection.class.getSimpleName()), serverHttpConnection); designer.link(challengeFunction.getFunctionObject(HttpSession.class.getSimpleName()), httpSession); for (SectionObject dependency : dependencyObjects) { designer.link(challengeFunction.getFunctionObject(dependency.getSectionObjectName()), dependency); FunctionFlow functionFlow = challengeFunction.getFunctionFlow("Flow_" + flowName); SectionOutput sectionOutput = designer.addSectionOutput(flowName, flowType.getArgumentType().getName(), false); HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_AUTHENTICATE, HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_AUTHENTICATE); moAuthFunction.getFunctionObject(FunctionAuthenticateContext.class.getSimpleName()).flagAsParameter(); for (SectionObject dependency : dependencyObjects) { designer.link(moAuthFunction.getFunctionObject(dependency.getSectionObjectName()), dependency); HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_LOGOUT, HttpSecurityManagedFunctionSource.FUNCTION_MANAGED_OBJECT_LOGOUT); moLogoutFunction.getFunctionObject(FunctionLogoutContext.class.getSimpleName()).flagAsParameter(); for (SectionObject dependency : dependencyObjects) { designer.link(moLogoutFunction.getFunctionObject(dependency.getSectionObjectName()), dependency); HttpSecurityManagedFunctionSource.FUNCTION_START_APPLICATION_AUTHENTICATE); startAuthFunction .getFunctionObject(StartApplicationHttpAuthenticateFunction.Dependencies.CREDENTIALS.name())