Hi,

I'm trying out the source code
(http://www.novell.com/developer/ndk/...n_service.html)
for setting the challenge and response of a user. Unfortunately it
doesn't work: when calling the forgotten password for that user in the
user app, an error appears ("Answers to challenge response questions
have not been set, or cannot be read at this time.") instead of a
challenge. A password policy (with "Enable Forgotten Password" and
"Allow user to reset password (Requires challenge set and Universal
Password options)" enabled) is set and assigned to the user, so this
should not be the problem

---
Sample Code (adapted to my environment)
---
// Setup password manager
Hashtable env = new Hashtable();
env.put(Context.SECURITY_PROTOCOL, "ssl");
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://my.idv");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=admins,dc=system");
env.put(Context.SECURITY_CREDENTIALS, "somepassword");
LdapContext context = new InitialLdapContext(env, null);
NMASChallengeResponseMgr crmgr = new NMASChallengeResponseMgr(context);

// read challenge
InputStream in = this.getClass().getResourceAsStream("/challenges.xml");
StringWriter writer = new StringWriter();
IOUtils.copy(in, writer);
String challenge = writer.toString();

// write challenge questions
String userDN= "cn=user01,dc=accounts,dc=data";
crmgr.setChallengeQuestions(userDN, challenge);

// write response
crmgr.setChallengeResponses(userDN, new String[] {"Enter Activation
Code"} , new String[] {"activationcode"});
---

challenges.xml is a file located in my classpath, IOUtils is a utility
class from commons-io

---
challenges.xml
---
<Challenges RandomQuestions="1" GUID="123456">
<Challenge Define="Admin" Type="Required" MinLength="2"
MaxLength="20">Enter Activation Code</Challenge>
</Challenges>
---

The code runs without exceptions and these attributes were added to the
user after executing the sample code:

---
sASLoginConfiguration:: RAAAAAUAAAAEAAAAHwAAAEMAaABhAGwAbABlAG4AZwBlAFIAZQ Bz

AHAAbwBuAHMAZQBRAHUAZQBzAHQAaQBvAG4AcwD4AAAANSjjHg 3umCHa4hQi8nTbXx4Nv4XduA6

2Z89Kk5nDTaO7JGl4HUNqZecRjT0CHqdjEBQMOs4hvV09/Ubfl5/aIVnbmkLOfOW1zxh++Kqbl5

uc1gGGZuyw2raClBUWlT0dBnW4MQVa8ZYndbXWr0VstNdwrYqz f38Sj05kJ025AWgwD21cFEySO

+Kma9vfeYFXz48dEOrC2OQPhDolc/YgOLGFnca05fELMbvVVauwt41oNL1EGNp6Lj3iClPCfC1p

6goiGtTg3CYu3BFzdAbuHveyuSt+ac3O3bldn9+LGYpSi1IcLR iGmm5tgBgsuEO2K6pqOZiI7GA
=
sASLoginConfigurationKey:: AAAAAM4AAAAwgcswgZMCAgIAAgEDMDICAQMGC2CGSAGG+DcBA

ggaAgIAqAIBAgIDEQAAgRTlBFwf0Fl0QihiEX9w+BOpHMj7qAQ gHYIGZjkruB7oz7b0UGw9G9FE

BBA55gxv9tS8LDr/JdgwIgYLYIZIAYb4NwECCBswEzARAgUAgAAABAQITk1BU0lWMD KCEN13cO8

O2qkKKcqXZ5hE46EwMzAPBgtghkgBhvg3AQIIDgUABCDLTFl0n 5CVJQpAG7h/DeZiywp/8Pi6S7
LKTBygosWQiQ==
sASLoginSecret:: OgAAAAUAAAAEAAAAHwAAAEUAbgB0AGUAcgAgAEEAYwB0AGkAdg BhAHQAaQB

vAG4AIABDAG8AZABlAFgAAADi2bktbDv2cziSChUN1yeBaMzdI S6HKPOi8hA+M8Qso8u0b7kano
qhottl+KSA3GsEZDl/cBPNSeVZY92BggWDjg6mcouk7aXgWT3bxbRsDrpwJnfrakJk
sASLoginSecretKey:: AAAAAM4AAAAwgcswgZMCAgIAAgEDMDICAQMGC2CGSAGG+DcBAg gaAgIA

qAIBAgIDEQAAgRQeVRJ5A7XxpM5OgrUJAidGifomSwQgQuWDMT aykwcJJwPvta9FmcNqY/NxvEz

CTWCbyPJsBJMwIgYLYIZIAYb4NwECCBswEzARAgUAgAAABAQIT k1BU0lWMDKCEN13cO8O2qkKKc

qXZ5hE46EwMzAPBgtghkgBhvg3AQIIDgUABCBGVqF8bhYoPagd GSQjtrxMmDx62uEUAW5Uk5P6c
ayNIg==
---

The sample code on the website is rather old and perhaps outdated? The
version of the user app i'm currently working on is
Identity Manager Roles Based Provisioning Module Version 4.0.0 Build
Revision 36902

Best regards

Pieter