Onboarding users with Native OData SDK – SMP 3.0
From SMP 3.0 onward we have two ways for registering a user with SMP Server.
1. MAF Logon
2. Using OData SDK
A lot of people go for using the MAF Logon. MAF Logon comes with a pre defined UI Screen for Logon functionality so the developers do not need to do anything to onboard users. They can just import the MAF projects inside their IDE (Android Studio/Eclipse for Android)/ Xcode for iOS and just run the application.
You can learn how to onboard users using MAF Logon from this link
But there could be a requirement that you do not want to use the SAP Standard screen and have your own custom login screen, to maintain UI consistency all over the application. For this we can onboard users using OData SDK. The tutorial on how to onboard users using OData SDK can be accessed using this link
You might run into difficulties to authenticate users against any sort of Authentication mechanism that you use like HTTP/HTTPS etc but with NoAuthenticationLoginModule it will onboard your user but when you login to the Management Cockpit it will show the user registered as no_sec_identity.
Follow the below set of code to successfully onboard your user against an authentication mechanism that you have configured against your application id
Assuming that you have your own custom screen with a field for username and password and a Login Button you can add this set of code on the button click event of your Login Button
private LogonCore logonCore; Define this as a global parameter at the start of your activity.
And within the button click event add this line of code
LogonCoreContext context = logonCore.getLogonContext();
context.setHost(smpHost); //address of your SMP Server or relay server
context.setPort(smpPort); // port of the SMP Server or port 80 if you are using the relay server
context.setHttps(false); // Set to TRUE if you are using https
context.setFarmId(“0”); //Set the FARM ID in case you are using the Relay Server
context.setResourcePath(“ias_relay_server/client/rs_client.dll); //User this if you are using the Relay Server
context.setBackendUser(smpUserId); //The field that the user will input his username
context.setBackendPassword(smpPassword); // The field that user will input his credentials
context.setChannel(Channel.REST); //This is a very important parameter to add else you would not be able to pass these parameters
With this you can see your user is authenticated against the security provider and now you can use all functionalities like SSO, Role Mapping etc relevant to your security provider.
Hope this helps you all and saves all of your time to debug the error.