This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to pass value from jsf to php

 
raghavendra bhat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have 2 applications.. one is my own application developed using JSF.. Another one is a document Repositary fully developed using PHP. Now i need to integrate both..

i dont kno anything abt php..

The problem is the user needs to login inside my jsf application and once he logs in that user imformation should be passed to php page which is responsible for the authentication process so as to check whether the user is valid user for the document repositary.. so the user need not provide his username and password seperately for the document repositary.. is this possible.. can any one help.. the scenario is the person who is authenticated for one particular usergroup of my jsf application will be automatically authenticated for doc rep..for both of these cases i need to understand how to pass value from jsf to php.
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming the PHP application is hosted somewhere you can always access the PHP service by submitting a POST HTTP request. Alternatively you can expose the PHP logic as a webservice (may be RESTful) and then invoke that webservice from your JSF application. In either case your PHP application should return some result indicating whether the user credentials are valid or not.
 
raghavendra bhat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I dont know anything about webservice.. but i will tell you what idea i have, check whether this is ok... i will start the php server and jboss each time my application starts.. so the doclib is avl for me in xamp.. when user enters the username and password in jsf page i get the values and pass it to the php code where the authentication takes place..




 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raghavendra bhat wrote:Hi, I dont know anything about webservice.. but i will tell you what idea i have, check whether this is ok... i will start the php server and jboss each time my application starts.. so the doclib is avl for me in xamp.. when user enters the username and password in jsf page i get the values and pass it to the php code where the authentication takes place..

this might work but I am not sure how good the approach is. Are you running them locally? i.e localhost? In anycase you send the data as request parameters to he URL on which your PHP application is running.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ideally, you would have some sort of SSO (Single Signon) service that both Java and PHP webapps could tap into. Java's built-in security allows for SSO Realms - the CAS system is one such provider and it's almost certainly usable with PHP as well.

Next best would be to implement a custom Realm that authenticated against the PHP system and used the results to construct the UserPrincipal object which anchors a user's identity within the Java webapp.

Worst would be to write a user-defined login process as part of the Java application itself and make it pass on the request using the HttpURLRequest object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic