jhullin

Updating Signer Challenge Questions

0 votes
I'm interested in modifying a signer's challenges on an existing package that hasn't been sent. In some cases this means adding a challenge for the first time. In other cases this means first removing existing challenges. Here's some code I tried. It runs without error, but it doesn't have the desired effect. Is this option built into the SDK? I tried using versions 10.10.1 and 11.0.
		EslClient eslClient = new EslClient( API_KEY, API_URL );

		// get the signer
		Signer signer = eslClient.getPackageService().getSigner(new PackageId(pkgId), signerId);
		
		// display current auth info
		System.out.println(signer.getAuthentication().getMethod());
		System.out.println(signer.getAuthentication().getChallenges());
		
		// clear list and add a new challenge
		signer.getAuthentication().getChallenges().clear();
		signer.getAuthentication().getChallenges().add(new Challenge("New Question", "New Answer"));	
		
		// update the signer
		eslClient.getPackageService().updateSigner(new PackageId(pkgId), signer);
		
		// retrieve updated signer from eslClient
		signer = eslClient.getPackageService().getSigner(new PackageId(pkgId), signerId);
		
		// display updated auth info
		System.out.println(signer.getAuthentication().getMethod());
		System.out.println(signer.getAuthentication().getChallenges());

Reply to: Updating Signer Challenge Questions

0 votes
Hi jhullin, I tried your code above using SDK 11.0.2 and it worked fine for me (i.e. I was able to update the challenge questions). Can you give it try using SDK 11.0.2? http://docs.esignlive.com/content/c_integrator_s_guide/sdk/a_introduction/intro_to_the_sdks.htm
Haris Haidary OneSpan Technical Consultant

Reply to: Updating Signer Challenge Questions

0 votes
I gave the latest SDK a try. I tried with two different sandbox accounts and two API URLs (with and without the hyphen). No luck.

Reply to: Updating Signer Challenge Questions

0 votes
My mistake, my code wasn't exactly the same as yours. Can you try the following:
Challenge c = new Challenge("Updated Question", "Updated Answer");
		
signer.getChallengeQuestions().clear();
signer.getChallengeQuestions().add(c);
		
eslClient.getPackageService().updateSigner(packageId, signer);
Haris Haidary OneSpan Technical Consultant

Reply to: Updating Signer Challenge Questions

0 votes
I still get the same result.

Reply to: Updating Signer Challenge Questions

0 votes
Can you share the package id for which you are testing this?
Haris Haidary OneSpan Technical Consultant

Reply to: Updating Signer Challenge Questions

0 votes
Sure thing: PHOUYJjWId5hEXf2eOAJ955iWhw=

Reply to: Updating Signer Challenge Questions

0 votes
I've done some testing and I think your best bet would be to build a new Signer object, as shown below:
Signer signer = eslClient.getPackageService().getSigner(packageId, signerId);

Signer updatedSigner = SignerBuilder.newSignerWithEmail(signer.getEmail())
		.withFirstName(signer.getFirstName())
		.withLastName(signer.getLastName())
		.withCustomId(signer.getId())
		.challengedWithQuestions(ChallengeBuilder.firstQuestion("What's your favorite sport?")
                .answer("soccer")
                .secondQuestion("What music instrument do you play?")
                .answer("drums"))
.build();

eslClient.getPackageService().updateSigner(packageId, updatedSigner);

signer = eslClient.getPackageService().getSigner(packageId, signerId);

System.out.println(signer.getAuthentication().getMethod());
System.out.println(signer.getAuthentication().getChallenges());
Haris Haidary OneSpan Technical Consultant

Reply to: Updating Signer Challenge Questions

0 votes
That does work, but I'd be concerned about accidentally leaving out, and therefore deleting, some other signer attributes. Is there a way to zero-in on just the signer's challenge questions using the SDK's RestClient? I assume not.

Reply to: Updating Signer Challenge Questions

0 votes
I don't think so either. I tried making a REST call to only update the challenge questions but without success. What I can suggest is in the updatedSigner object, add all possible signer attributes you would normally set. This way, even if it wasn't set previously, it would show up as empty in the updated signer.
Haris Haidary OneSpan Technical Consultant

Reply to: Updating Signer Challenge Questions

0 votes
I had a hunch that the EslClient was holding on to some stale state. I was able to get this working by creating a new instance of EslClient after retrieving the Signer.
		EslClient eslClient = new EslClient( API_KEY, API_URL );

		// get the signer
		Signer signer = eslClient.getPackageService().getSigner(new PackageId(pkgId), signerId);
		
		// display current auth info
		System.out.println(signer.getAuthentication().getMethod());
		System.out.println(signer.getAuthentication().getChallenges());
		
		// clear list and add a new challenge
		Challenge c = new Challenge("Different Question", "Different Answer");
		signer.getChallengeQuestions().clear();
		signer.getChallengeQuestions().add(c);
		
		eslClient = new EslClient( API_KEY, API_URL );	// try creating a new instance
		
		eslClient.getPackageService().updateSigner(new PackageId(pkgId), signer);

		// display updated auth info
		System.out.println(signer.getAuthentication().getMethod());
		System.out.println(signer.getAuthentication().getChallenges());

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off