on 01-18-2013 5:40 PM
Hi ,
My question is that is it possible to synchronize if we are using only user and activation code for login instead of using the SCC credentials (supAdmin and s3pAdmin) ?
I developed an android native application in which I am able to synchronize when I login to the application with the SCC login credentials (supAdmin and s3pAdmin).
Code used:
try {
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName(HOST);
connProps.setPortNumber(PORT);
ApprovalDB.setApplication(app);
LoginCredentials loginCredentials = new LoginCredentials(
USERNAME, PASSWORD);
connProps.setLoginCredentials(loginCredentials);
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(600);
} else {
app.startConnection(600);
}
} catch (Exception e) {
returnMsg = e.getMessage();
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
But when I login to the application with manually created user and activation code I am not able to synchronize. Login happens successfully and the device comes online in the SCC.
The error is "The synchronization failed because Mobilink returned authentication status 4 with value 4000"
Code used:
try {
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName(HOST);
connProps.setPortNumber(PORT);
ApprovalDB.setApplication(app);
LoginCredentials loginCredentials = new LoginCredentials(
USERNAME, PASSWORD);
connProps.setActivationCode(PASSWORD);
connProps.setLoginCredentials(loginCredentials);
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(600);
} else {
app.startConnection(600);
}
} catch (Exception e) {
returnMsg = e.getMessage();
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Finally the code used for synchronization is
ConnectionProfile connectionProfile = ApprovalDB
.getSynchronizationProfile();
connectionProfile.setServerName("server ip");
connectionProfile.setPortNumber(2480);
connectionProfile.setNetworkProtocol("http");
connectionProfile.setAsyncReplay(true);
connectionProfile.setDomainName("default");
connectionProfile.save();
PersonalizationParameters param = ApprovalDB
.getPersonalizationParameters();
param.setPK_CODE(1234);
param.save();
Log.d("Subscribe", "Start");
ApprovalDB.subscribe();
Log.d("Subscribe", "End");
ApprovalDB.submitPendingOperations();
ApprovalDB.disableChangeLog();
ApprovalDB.synchronize();
SynchronizationGroup sg = ApprovalDB
.getSynchronizationGroup("SynchronizationGroup1");
sg.setEnableSIS(true);
sg.save();
ApprovalDB.synchronize();
-----------------------------------------------------------------------------------------------------------------------------------
Can anyone give a solution.
Of course, possible. You need to add the security rule for the application which uses some authentication module, e.g. no sec (or Ldap). This means that before SUP registers you, it checks the user name and password using this module.
This approach must be used for automatic registration (because it is universal for many users). However, when you register user manually, you specify user name and activation code. Actually, you can use ANY user name and ANY code. But these credentials must be typed by user in the application.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the LDAP is implemeted whaat will the change in the native android code?
Or can I use the username and password from the LDAP repository in place of supAdmin and s3pAdmin without any change in the android native code?
Based on the discussion with some of my friends I could found that there is no need to change the native code.
I just want to confirm.
Thanks for your comments.
Based on your comments and several discussions I found that we need to configure LDAP in order to perform the synchronization in the given scenario.
I got a couple questions to Vladislav. What do you mean by "no sec"? How to do that if I am not going for LDAP? Is it a good approach?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On the whole if you are creating a production-grade application you want to avoid these use cases:
-using supAdmin credentials (intended only for admin authentication)
-using preConfigured (only intended for initial security access to SCC) or no Security login modules (only recomended for dev/test usecases as all users are allowed access at all times; not security grade)
-using admin security configuration on the default domain (also exclusively intended for admin authentication)
In an ideal case you'd want to use LDAP to authenticate against a proper LDAP entry on the back end and use this provider in a custom security configuration.
For 2.1.3, the complete set of providers and tasks to enable/config them are here:
For 2.2, the docs are here:
The supported providers can vary slightly release-to-release, so do review the documentation and ensure you select the best security provider and perform the correct configuration for your scenario.
Cheers,
Annette
Hi Midhun,
I understand what you are looking at.
The error that you are getting was even faced by me and after struggling for around 15 days i read it on a website that this error is faced when the user is not authorized for the mobilink channel for synchronization.
Since supAdmin is a built in account on the Sybase Control Center we donot face the error while using it.
This is where i realized what the error was and turned out two ways to tackle it.
Method 1:
You create the user and activation code on the SCC Portal and use the same in the program.
If you would have observed the device registers with this method but does not synchronize.
So what i did is something like this.
ConnectionProperties connProps = app.getConnectionProperties();
connProps.setServerName(HOST);
connProps.setPortNumber(PORT);
ApprovalDB.setApplication(app);
LoginCredentials loginCredentials = new LoginCredentials(
USERNAME, PASSWORD);
connProps.setActivationCode(PASSWORD);
connProps.setLoginCredentials(loginCredentials);
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(600);
} else {
app.startConnection(600);
}
} catch (Exception e) {
returnMsg = e.getMessage();
}
Here USERNAME and PASSWORD will be the one created in the SCC , viz the username and activation code.
Then just before synchronization you set the login credentials hardcoded in the program itself.
The code will go as follows
LoginCredentials newcred=new LoginCredentials("supAdmin","s3pAdmin");
ConnectionProfile connectionProfile = ApprovalDB
.getSynchronizationProfile();
connectionProfile.setServerName("server ip");
connectionProfile.setPortNumber(2480);
connectionProfile.setNetworkProtocol("http");
connectionProfile.setAsyncReplay(true);
connectionProfile.setDomainName("default");
connectionProfile.setLoginCredentials(newcred);
connectionProfile.save();
PersonalizationParameters param = ApprovalDB
.getPersonalizationParameters();
param.setPK_CODE(1234);
param.save();
Log.d("Subscribe", "Start");
ApprovalDB.subscribe();
Log.d("Subscribe", "End");
ApprovalDB.submitPendingOperations();
ApprovalDB.disableChangeLog();
ApprovalDB.synchronize();
SynchronizationGroup sg = ApprovalDB
.getSynchronizationGroup("SynchronizationGroup1");
sg.setEnableSIS(true);
sg.save();
ApprovalDB.synchronize();
This will solve your problem.
Method 2:
You can create users on SCC and then login with those credentials.
In this method, you dont have to hardcode the credentials as well.
It goes in this way
Go to Sybase Control Center and Click on Security on the left.
Then click on Authentication Tab.
Then click on new and then select the login module of your choice.
Try com.sybase.security.core.PreConfiguredUserLoginModule and create a username and password for e.g username : test password :test@123
Then use the same credentials in the android code.
This will solve your error.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.