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
10 changes: 8 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

<artifactId>search-for-user-node</artifactId>
<groupId>org.forgerock.am</groupId>
<version>6.0.0-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<name>Search For User Authentication Node</name>

<description>An Authentication Tree Node for ForgeRock's Identity Platform</description>

<properties>
<am.version>5.5.0</am.version>
<am.version>7.1.0</am.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -82,6 +82,12 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package org.forgerock.openam.auth.nodes;

import com.google.inject.assistedinject.Assisted;
import com.sun.identity.shared.debug.Debug;
import org.forgerock.guava.common.collect.ImmutableList;
import org.forgerock.json.JsonValue;
import org.forgerock.openam.annotations.sm.Attribute;
import org.forgerock.openam.auth.node.api.*;
Expand All @@ -28,6 +26,8 @@
import static org.forgerock.openam.auth.node.api.SharedStateConstants.USERNAME;
import org.forgerock.openam.core.CoreWrapper;
import com.sun.identity.idm.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;

Expand All @@ -40,8 +40,8 @@
configClass = SearchForUserNode.Config.class)
public class SearchForUserNode implements Node {

private final static String DEBUG_FILE = "SearchForUserNode";
protected Debug debug = Debug.getInstance(DEBUG_FILE);
private final static String NODE_NAME = "SearchForUserNode";
private static final Logger debug = LoggerFactory.getLogger(SearchForUserNode.class);
private final CoreWrapper coreWrapper;

/**
Expand Down Expand Up @@ -82,7 +82,7 @@ public SearchForUserNode(@Assisted Config config, CoreWrapper coreWrapper) throw
@Override
public Action process(TreeContext context) throws NodeProcessException {

debug.message("[" + DEBUG_FILE + "]: " + "Starting");
debug.debug("[" + NODE_NAME + "]: " + "Starting");
AMIdentity userIdentity = null;

//Pull out the user object
Expand All @@ -91,8 +91,8 @@ public Action process(TreeContext context) throws NodeProcessException {
} else {
Set<String> userSearchAttributes = new HashSet<>();
userSearchAttributes.add(config.datastoreAttribute());
debug.message("[" + DEBUG_FILE + "]: " + "Datastore attribute: {}", config.datastoreAttribute());
debug.message("[" + DEBUG_FILE + "]: " + "Shared state attribute: {}, and value: {}", config.sharedStateAttribute(), context.sharedState.get(config.sharedStateAttribute()).asString());
debug.debug("[" + NODE_NAME + "]: " + "Datastore attribute: {}", config.datastoreAttribute());
debug.debug("[" + NODE_NAME + "]: " + "Shared state attribute: {}, and value: {}", config.sharedStateAttribute(), context.sharedState.get(config.sharedStateAttribute()).asString());
userIdentity = IdUtils.getIdentity(context.sharedState.get(config.sharedStateAttribute()).asString(), context.sharedState.get(REALM).asString(),userSearchAttributes);

}
Expand All @@ -101,12 +101,12 @@ public Action process(TreeContext context) throws NodeProcessException {

if (userIdentity == null) {

debug.error("[" + DEBUG_FILE + "]: " + "Unable to find user");
debug.error("[" + NODE_NAME + "]: " + "Unable to find user");
return goTo("notFound").build();

} else {

debug.message("[" + DEBUG_FILE + "]: " + "user found: {}", userIdentity.getName());
debug.debug("[" + NODE_NAME + "]: " + "user found: {}", userIdentity.getName());
//ensure username is set in sharedstate
context.sharedState.put(USERNAME, userIdentity.getName());
return goTo("found").build();
Expand All @@ -116,7 +116,7 @@ public Action process(TreeContext context) throws NodeProcessException {

} catch (Exception e) {

debug.error("[" + DEBUG_FILE + "]: " + "Node exception", e);
debug.error("[" + NODE_NAME + "]: " + "Node exception", e);
return goTo("notFound").build();
}
}
Expand All @@ -131,9 +131,10 @@ static final class OutcomeProvider implements org.forgerock.openam.auth.node.api
@Override
public List<Outcome> getOutcomes(PreferredLocales locales, JsonValue nodeAttributes) {
ResourceBundle bundle = locales.getBundleInPreferredLocale(BUNDLE, OutcomeProvider.class.getClassLoader());
return ImmutableList.of(
new Outcome( "found", bundle.getString("found")),
new Outcome("notFound", bundle.getString("notFound")));
List<Outcome> list = new ArrayList<Outcome>();
list.add(new Outcome( "found", bundle.getString("found")));
list.add(new Outcome("notFound", bundle.getString("notFound")));
return list;
}
}
}