Highlighted
seba4 Respected Contributor.
Respected Contributor.
93 views

Custom Authentication class build - Error can't find correct jar file

Hi i am trying to build custom Authentication class. Simplified version with only setting variable and logging works. The problem is that when i try to add code WSCMOPToken or WSCToken then Eclipse doesn't build because it doesn't have this definition. I was looking inside NAM but i can't find where this is set.  Which jar file do i need to include in build library?

What i am trying to achieve:

 I wan't to save some "someValue" inside Custom Profile - Customizable String One

0 Likes
3 Replies
ericveysey Trusted Contributor.
Trusted Contributor.

Re: Custom Authentication class build - Error can't find correct jar file

I usually just import all the classes from NAM. This way you don’t have to peak inside to find the right one. Then you can build your class without worry.
0 Likes
seba4 Respected Contributor.
Respected Contributor.

Re: Custom Authentication class build - Error can't find correct jar file

Thank you for your reply. This really helped me.

0 Likes
seba4 Respected Contributor.
Respected Contributor.

Re: Custom Authentication class build - Error can't find correct jar file

I have finally managed to build .jar file but i am having a hard time saving Value into CustomizableString1.

 

My current doAuthenticate() function looks like that:

protected int doAuthenticate()
{ 	
	String attribute1 = "SomeDummyValue";
	
	
	
	try
	{
		// Customizable attribute 1 is the one we use to contain customer data to send,
		// but this can change to another if necessary
		WSCMOPToken token = (WSCMOPToken)WSCToken.getToken(WSCMOPToken.OP_CS_CustomizableString1.getTokenUniqueId());

		// Build object for new data
		WSFModelEntry modelEntry = token.getModelEntry();
		IDSISCommonAttributeElement data = modelEntry.getSchemaClassInstance();
		if (data instanceof IDSISLeafAttributeElement)
			((IDSISLeafAttributeElement)data).setText(attribute1);
	
		WSCMDataToken dataToken = new WSCMDataToken(token, data);
		dataToken.setAllowOverride(true);	
		
		WSCResponse response = WSC.modifyData(session, new WSCMDataToken[] {dataToken},m_Request.getLocale());
	}
	catch (Exception e) {
		System.out.println("StackTrace: ");
	}
	return AUTHENTICATED;
}

This code returns an error:  200103003
Based on description: Unable to locate an identity id from the authentications available in the provided NIDPSession.

I suspect the problem is that session doesn't exist yet but it's required.

 

In some forum posts i have noticed that they didn't have 

WSCResponse response = WSC.modifyData(session, new WSCMDataToken[] {dataToken},m_Request.getLocale());

 

In this case when i remove that line, user successfully authenticates but value is not saved into Custom Profile - Customizable String One.

I was searching for more documentation regarding that but i can't find a solution for that. Does anyone have an idea what am i doing wrong?


What i want to solve:
When user authenticates to idp, i wan't to read user's IP and save it into Custom Profile - Customizable String One. This value is then used for REST request.

Thank you for your time and help.

 

 

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.