Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
17 changes: 13 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<?xml version="1.0" encoding="UTF-8"?>
<!--
* The contents of this file are subject to the terms of the Common Development and
Expand Down Expand Up @@ -28,7 +29,7 @@
<description>An Authentication Tree Node for ForgeRock's Identity Platform</description>

<properties>
<am.version>6.5.0</am.version>
<am.version>7.2.0</am.version>
</properties>

<dependencyManagement>
Expand All @@ -48,6 +49,14 @@
<groupId>org.forgerock.am</groupId>
<artifactId>auth-node-api</artifactId>
</dependency>
<dependency>
<groupId>org.forgerock.am</groupId>
<artifactId>auth-nodes</artifactId>
</dependency>
<dependency>
<groupId>org.forgerock.am</groupId>
<artifactId>scripting-api</artifactId>
</dependency>
<dependency>
<groupId>org.forgerock.am</groupId>
<artifactId>openam-guice-core</artifactId>
Expand Down Expand Up @@ -84,8 +93,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand All @@ -101,4 +110,4 @@
<url>http://maven.forgerock.org/repo/private-releases</url>
</repository>
</repositories>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,25 @@
import com.google.inject.assistedinject.Assisted;
import com.sun.identity.authentication.callbacks.HiddenValueCallback;
import com.sun.identity.authentication.callbacks.ScriptTextOutputCallback;
import com.sun.identity.shared.debug.Debug;
// import com.sun.identity.shared.debug.Debug;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import org.forgerock.json.JsonValue;
import org.forgerock.openam.annotations.sm.Attribute;
import org.forgerock.openam.auth.node.api.*;
import org.forgerock.openam.scripting.Script;
import org.forgerock.openam.scripting.ScriptConstants;
import org.forgerock.openam.scripting.service.ScriptConfiguration;
import org.forgerock.openam.scripting.domain.Script;
import org.forgerock.openam.scripting.persistence.config.consumer.ScriptContext;
// import org.forgerock.openam.scripting.service.ScriptConfiguration;
import org.forgerock.openam.authentication.service.AuthModuleScriptContext;
import javax.security.auth.callback.Callback;
import java.util.Optional;
import static org.forgerock.openam.auth.node.api.Action.send;
import javax.inject.Inject;
import static org.forgerock.openam.auth.nodes.clientscript.AuthNodesScriptContext.AUTHENTICATION_CLIENT_SIDE;
import static org.forgerock.openam.auth.nodes.clientscript.AuthNodesScriptContext.AUTHENTICATION_CLIENT_SIDE_NAME;



Expand All @@ -49,7 +55,7 @@
public class ClientScriptNode extends SingleOutcomeNode {

private final static String DEBUG_FILE = "ClientScriptNode";
protected Debug debug = Debug.getInstance(DEBUG_FILE);
protected Logger debug = LoggerFactory.getLogger(DEBUG_FILE);
private static final String BUNDLE = "org/forgerock/openam/auth/nodes/ClientScriptNode";

/**
Expand All @@ -61,8 +67,10 @@ public interface Config {
* @return the amount.
*/
@Attribute(order = 100)
@Script(ScriptConstants.AUTHENTICATION_CLIENT_SIDE_NAME)
ScriptConfiguration script();
@ScriptContext(AUTHENTICATION_CLIENT_SIDE_NAME)
default Script script() {
return Script.EMPTY_SCRIPT;
}

@Attribute(order = 200)
String scriptResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ClientScriptNodePlugin(AnnotatedServiceRegistry serviceRegistry) {

@Override
public String getPluginVersion() {
return "1.0.1";
return "1.0.2";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2021 ForgeRock AS.
*/
package org.forgerock.openam.auth.nodes.clientscript;

import org.forgerock.openam.scripting.domain.ScriptContext;

/**
* Definitions of {@link ScriptContext}s for authentication nodes scripts.
*/
public enum AuthNodesScriptContext implements ScriptContext {

/**
* The default authentication tree decision node script context.
*/
AUTHENTICATION_CLIENT_SIDE,
/**
* The default config provider node script context.
*/
CONFIG_PROVIDER_NODE;

/**
* Compile-time constants to reference this context with.
*/
public static final String AUTHENTICATION_CLIENT_SIDE_NAME = "AUTHENTICATION_CLIENT_SIDE";

/**
* Compile-time constants to reference this context with.
*/
public static final String CONFIG_PROVIDER_NODE_NAME = "CONFIG_PROVIDER_NODE";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2021-2022 ForgeRock AS.
*/

package org.forgerock.openam.auth.nodes.clientscript;

// import static org.forgerock.openam.auth.nodes.clientscript.AuthNodesGlobalScript.CONFIG_PROVIDER_NODE_SCRIPT;
// import static org.forgerock.openam.auth.nodes.clientscript.AuthNodesGlobalScript.DECISION_NODE_SCRIPT;
import static org.forgerock.openam.auth.nodes.clientscript.AuthNodesScriptContext.AUTHENTICATION_CLIENT_SIDE;
// import static org.forgerock.openam.auth.nodes.clientscript.AuthNodesScriptContext.CONFIG_PROVIDER_NODE;

import java.util.ArrayList;
import java.util.List;

import org.forgerock.openam.scripting.domain.ScriptContextDetails;
import org.forgerock.openam.scripting.persistence.config.defaults.AnnotatedServiceRegistryScriptContextDetailsProvider;
import org.forgerock.openam.sm.AnnotatedServiceRegistry;

import com.google.inject.Inject;

/**
* Responsible for providing the auth node script contexts.
*/
public class AuthNodesScriptContextProvider extends AnnotatedServiceRegistryScriptContextDetailsProvider {



@Inject
AuthNodesScriptContextProvider(AnnotatedServiceRegistry annotatedServiceRegistry) {
super(annotatedServiceRegistry);
}

@Override
public List<ScriptContextDetails> get() {
List<ScriptContextDetails> scriptContexts = new ArrayList<>();

scriptContexts.add(ScriptContextDetails.builder()
.withContextReference(AUTHENTICATION_CLIENT_SIDE)
.withI18NKey("script-type-03")
.build());


return scriptContexts;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2021 ForgeRock AS.
*/
package org.forgerock.openam.auth.nodes.clientscript;

// import org.forgerock.openam.auth.nodes.clientscript.AuthNodesScriptContextProvider;
import org.forgerock.openam.scripting.persistence.config.defaults.ScriptContextDetailsProvider;

import com.google.inject.AbstractModule;
import com.google.inject.multibindings.Multibinder;

/**
* Guice Module for configuring bindings for the scripted decision node.
*/
public class ScriptedNodeGuiceModule extends AbstractModule {
@Override
protected void configure() {
Multibinder.newSetBinder(binder(), ScriptContextDetailsProvider.class)
.addBinding().to(AuthNodesScriptContextProvider.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2021 ForgeRock AS.
*/
/**
* This package contains classes related to authentication node scripts.
*/
package org.forgerock.openam.auth.nodes.script;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.forgerock.openam.auth.nodes.clientscript.ScriptedNodeGuiceModule