function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JohanButsJohanButs 

Single Sign-On - Partner Portal (java) and Custom Portal (php)

I have a question about the integration between the partner portal toolkit, which is written in java, with our already available portal to customers (written in php).

We want to make salesforce data available to portal users but also provide custom pages which are written in php.

I wonder how we can fix the problem of signing in 2 pieces:
- once for our own portal (php)
- once for the salesforce portal (java)

Is there anybody who has experience with this or has knowledge of closing the gap between php and java ?

many thnx in advance
adamgadamg
In theory you can pass the SID (session id) from the java (JSP) page to the PHP page in the query string..
JohanButsJohanButs
I think you have it the other way arround.

We have the following:

- a database with users, with following fields: (mysql)
- username (for login in to php portal - build by us)
- pasword (for login in to php portal - build by us)
- salesforceflag (can be true or false --> true = may access sf via partner portal, false= can't access sf via partner portal)
- salesforceusername (if flag= true this is used to login the user in salesforce)
- salesforcepasw (if flag= true this is used to login the user in salesforce)

So our users login to our php portal and their credentials are checked in our own custom database (see above). If the user is allowed to access salesforce data (flag = true) then a link will be visible in the portal. When the user clicks that link i don't want a prompt (that partner portal has) to login with a salesforce account. I want the user automatically signed in when he logs in via our portal or clicks the salesforce link (doesn't mather where the salesforce login occurs).

Is there any method to acomplish this ?

What is the best way (if possible) ?
- log in via php using the phptoolkit for sforce and hold the sessionid and then pass it?
- also call java (because partner portal is written in java) when the user logs in via our php portal ?
- or use ajax toolkit from salesforce: login via php and also execute a javascript function which logs in to salesforce and returns the sessionid and pass this to the page when i hit the salesforce link ?

i really don't know :(
adamgadamg
Ok, I'm not sure if you are trying to auto-login your users to Salesforce or to the partner portal.

If, according to your DB, the user has a salesforce.com username/pass, you can generate a session ID for that user using the API, and present a link to automatically log them into Salesforce. You can generate that session ID using your choice of tool - PHP, Java or Ajax will all work.

If instead you are trying to automatically log them into the partner portal, I'd need to ask the one of the devs if that is possible (if not you'd need to mod your partner portal code.)
JohanButsJohanButs
I am trying to login my user in salesforce automatically. I'll list the steps my user has to take.

1) a user logs in via our php portal (user is authenticated using our own database - mysql) so no salesforce in this step

2) depending if the user has salesforce access (a true/false field in our own database) a html link is shown named "leads", if the user as no access (false) nothing is shown

3) when a user with access to salesforce (our true/false field) clicks the "leads" link i want the user automatically see the partner portal pages without login in again (with salesforce username & password)

NOTICE:
-------

- the username and password we use for our php portal are not the same as the salesforce username and password
- the users are api only user (for security)

MY QUESTION :)
--------------

if a user logs via our php portal can i invoke a API call that logs the user in to salesforce also ?

if yes: do i have to store the sessionid and do i have to use it in the link for "leads" ?

- how do i perform the api call ? (the best for this situation) AJAX or PHP
adamgadamg
I'm still not clear if you are trying to SSO your users into Salesforce (ie the app) or the partner portal - they are seperate things.
JohanButsJohanButs
The thing that we are trying to achieve is that a user does a single sign on to access 2 things (in the future more):

1) no info related to salesforce e.g. newsletters, news, ... (= custom made PHP pages)

2) info from salesforce (if they have access to it) (= parter portal pages = JSP)

future: in the future we want the SSO also to other parts of our own portal e.g. order registration, ...

----------

So when a user logs in i don't want to ask him to login again for accessing the salesforce info. So the user logs in with a username and password WE give him to access our custom (PHP) portal. When that user has ACCESS to salesforce he can see a html link that points to the SALESFORCE PARTNER PORTAL. Because the username we provide him is not equal to his username and password in salesforce the portal will prompt to login. That is what we want to avoid (the second login).

So what do i have to do to avoid the login prompt of the partner portal ?

----------

My suggestions / thoughts / questions to you guys:

- when i login through our portal i will have a seperate script that log the user in to salesforce and store the sessionid in our database. When the user clicks the link that points to the salesforce data i include the sessionid in the url.

==> DOES THIS WORK ???
adamgadamg

- when i login through our portal i will have a seperate script that log the user in to salesforce and store the sessionid in our database. When the user clicks the link that points to the salesforce data i include the sessionid in the url.
>>

Yes, this should work. You will generate the session id by using the login call of the API, and will then pass the SID to the partner portal. I don't know the specifics of the partner portal to know where/how you'd pass in the SID, but have asked on the of the developers to chime in. (As I presume you are running the code yourself, at worst it should be a small mod your portal.
mtbclimbermtbclimber
In the toolkit you downloaded there is no built-in facility to accept the session id as a parameter to bypass the login screen. This would be fairly simple to implement since the entire goal of the login process is to acquire the session Id.

My recommendation would be to add an action class for welcome action that looks for the session id as a query string parameter, if it exists validate it by calling GetUserInfo (since it's needed in the session and right now is acquired from the LoginResult which you will not have). If no param exists or if the session id is not valid, set your action forward to the login jsp as is now the default forward for the welcome action.