Search in sources :

Example 1 with JsWritableParameters

use of org.wso2.carbon.identity.application.authentication.framework.config.model.graph.js.JsWritableParameters in project carbon-identity-framework by wso2.

the class GraphBasedSequenceHandler method executeFunction.

private void executeFunction(String outcomeName, DynamicDecisionNode dynamicDecisionNode, AuthenticationContext context, Map<String, Object> data) {
    SerializableJsFunction fn = dynamicDecisionNode.getFunctionMap().get(outcomeName);
    FrameworkServiceDataHolder dataHolder = FrameworkServiceDataHolder.getInstance();
    JsGraphBuilderFactory jsGraphBuilderFactory = dataHolder.getJsGraphBuilderFactory();
    JsGraphBuilder jsGraphBuilder = jsGraphBuilderFactory.createBuilder(context, context.getSequenceConfig().getAuthenticationGraph().getStepMap(), dynamicDecisionNode);
    JsGraphBuilder.JsBasedEvaluator jsBasedEvaluator = jsGraphBuilder.new JsBasedEvaluator(fn);
    jsBasedEvaluator.evaluate(context, (jsConsumer) -> jsConsumer.call(null, new JsAuthenticationContext(context), new JsWritableParameters(data)));
    if (dynamicDecisionNode.getDefaultEdge() == null) {
        dynamicDecisionNode.setDefaultEdge(new EndStep());
    }
}
Also used : JsGraphBuilderFactory(org.wso2.carbon.identity.application.authentication.framework.config.model.graph.JsGraphBuilderFactory) JsWritableParameters(org.wso2.carbon.identity.application.authentication.framework.config.model.graph.js.JsWritableParameters) JsAuthenticationContext(org.wso2.carbon.identity.application.authentication.framework.config.model.graph.js.JsAuthenticationContext) JsGraphBuilder(org.wso2.carbon.identity.application.authentication.framework.config.model.graph.JsGraphBuilder) FrameworkServiceDataHolder(org.wso2.carbon.identity.application.authentication.framework.internal.FrameworkServiceDataHolder) EndStep(org.wso2.carbon.identity.application.authentication.framework.config.model.graph.EndStep) SerializableJsFunction(org.wso2.carbon.identity.application.authentication.framework.config.model.graph.SerializableJsFunction)

Aggregations

EndStep (org.wso2.carbon.identity.application.authentication.framework.config.model.graph.EndStep)1 JsGraphBuilder (org.wso2.carbon.identity.application.authentication.framework.config.model.graph.JsGraphBuilder)1 JsGraphBuilderFactory (org.wso2.carbon.identity.application.authentication.framework.config.model.graph.JsGraphBuilderFactory)1 SerializableJsFunction (org.wso2.carbon.identity.application.authentication.framework.config.model.graph.SerializableJsFunction)1 JsAuthenticationContext (org.wso2.carbon.identity.application.authentication.framework.config.model.graph.js.JsAuthenticationContext)1 JsWritableParameters (org.wso2.carbon.identity.application.authentication.framework.config.model.graph.js.JsWritableParameters)1 FrameworkServiceDataHolder (org.wso2.carbon.identity.application.authentication.framework.internal.FrameworkServiceDataHolder)1