How can manage session in javafx desktop application

i have created a javafx desktop application and  my application also consume  restWebService for login and logout puspose. now how i can maintain session of any particular user??
please if u have any idea let me know??
thanx in advance.

With the setup you have described, you don't need to maintain much of a session like in a traditional browser or a web app server scenario. 
WIth a traditional web application, when a login authentication passes, normally a cookie is set in the browser to indicate that a session has been established and is cleared on logout to indicate that the session is over.  When the browser client talks to the server it sends the cookie across to the server and the server (using something like the servlet api) decodes the cookie to determine the session and makes use of appropriate session state to access a store of session related data which it eventually just throws away on logout or on session timeout.  The cookie is normally a random piece of data which forms a unique id for the session and is normally generated on the server.
If you are using rest apis then they should be coded to be stateless, so there is no session involved, every request to the server is self contained and contains all the information required to authenticate the user.  (e.g. the user/password hash is passed every time).  Sometimes a variant will be used where a token is passed, for example an oauth token, representing delegated authentication from another service.  But you likely don't need to do that and just passing the full auth information everytime is sufficient.  The server itself also maintains no state, it just does the auth based on the credentials passed with each request and then performs what ever action it needs to create and return the resource requested.
So really, all you need to do is to:
1. Prompt user for login credentials (user/pass).
2. Hash the pass and make a rest call to the server for validation (http basic auth over https could be used for this).
3. If the auth passes, then store the current user/pass hash as application data somewhere (e.g. members of your application class instance).
4. When you need to make another rest call, query the application instance for the user / pass hash and include that in the call.
5. When the user logs out, clear the user / pass hash from the application (set it to null).
6. Show the login prompt again for the user.
Note that using other communications systems (such as akka, hessian, spring remoting etc), may be a bit simpler for some kinds of JavaFX client/server applications than using REST.

Similar Messages

  • How to manage sessions of two diiferent applications using SSO

    Im new to JAVA , i have two different apllication with different session management, How to make it a common session management, how to reset the timer program in JAVA for every 300 secs.Please help me out with ideas and send me the sample code timer program that can run for 300 secs and it has to be reseted when requests comes if there is any, otherwise it has to log out

    Yes total users should be around 5000, but there could be around 500 users accessing concurrently. Besides we are using to BOE to show a dashboard, with charts and graphs(using the HTMLView) so we will have to 500 concurrent IEnterprise sessions. I just hope that:
    1. Each session is unique(independent thread) although they have logged on using the same credentials
    2. The CMS server can scale upto this number(500). Don't know if there are some caching options available?

  • I recently purchased the newest nano. I have 3 other nano's and iPad   iPhone, oh and iPod touch. When I plug in nano to my mac I get the message "iPod cannot update because it contains files that are used by another application. How can manage this?

    I recently purchased the newest nano. I have 3 other nano's and iPad   iPhone, oh and iPod touch. When I plug in nano to my mac I get the message "iPod cannot update because it contains files that are used by another application. How can manage this?

    dedonred wrote:
    "iPod cannot update because it contains files that are used by another application.
    It means that nano was used on a third-party software or synced from different computer to sync music. Does that nano show in iTunes? If yes, then restore completely. If not, then you may need to head to Apple Store and see what they can do.

  • How can I get back into my application aftermath invoking Start up page of index.htm ?

    Gorgeous Hello All,
    If anyone of you can please provide me a solution for the following, will help me in plentious and galore.
    Am using Adobe RoboHelp, Version 10 and IE version being 10.
    A hurdle :-
    I have a application which has been developed in ASP .NET, Version 4.0. Help link has been created in this application wherein here the Start up page of index.htm has been linked to be read from the RoboHelp local project folder\!SSL!\Multiscreen_HTML5\desktop. All are working absolutely fine except when
    I login into the above-said application -> click on the Help page -> the index.htm opens with Contents, Index, Glossary -> Am able to successfully perform any task by respective clickings
    -> But I am not able to get back into my application when I click on the IE provided Back button (Alt+Left) -> Any amount of invoking Back button makes the system getting looped into this Start up page of index.htm only -> When I Close Tab (Ctrl + W) or Close ( X ) -> The window session gets closed and I have to repeat all by relogin once again.
    How can I get back into my application aftermath invoking Start up page of index.htm ?
    (I can always get back into the application easily by erasing those parts in the url which refers to this RoboHelp linkages – but this certainly looks non-polished work)
    Help Please
    Cheese – Vipin Nambiar, Bangalore

    Hey Jeff, I used Internet Explorer 10.0.9200 and Google Chrome 26.0.1410. Alas - it is the same behavior.
    (But Jeff : When I used Microsoft HTML Help as primary layout to generate chm file , My Help when launched from my Application opened in a new browser window and when I closed this Help browser window did not close my application. Looks like need to write few liner code to get this issue settled )
    Thanks Indeed of lots for your concerns Jeff !!!

  • How can I install Creative Cloud Desktop on a MacBook Pro running Parallels Desktop and Windows 8.1?

    Does anyone have any help for installing Creative Cloud on a MacBook Pro running Parallels Desktop and Windows 8.1? I downloaded the app, double-clicked it, said yes to allowing it to change my system, and received a notice of installation failure with Error code 1000. Any help much appreciated.

    RogueResearcher please see Error "Failed to Install" Creative Cloud Desktop application - http://helpx.adobe.com/creative-cloud/kb/failed-install-creative-cloud-desktop.html for information on how to install the Creative Cloud Desktop application.  If you continue to experience Error Code 1000 can you please post a screen shot of the error?  Please see FAQ: How do I capture and post a screen shot or video? for information on how to post an image.

  • There used to be a "spaces" selection in sys prefs in 10.5; how can I switch to another desktop space if I don't have a trackpad?

    There used to be a "spaces" selection in sys prefs in 10.5; how can I switch to another desktop space if I don't have a trackpad?

    You can either click on Mission Control in your dock/Applications folder & select a space or your can use 'CTRL+ left or right arrow to navigate through spaces'

  • How to manage session ?

    Hi Java Gurus,
    Can any body tell me how to manage session in java.
    I have two url say http://www.xyz/userlogin.php, http://www.xyz/sendsms.php
    1st url gives the login form and second one coes after succesfull login.
    Now I am not using any web browser. I have to surf these pages through java code using java api ( HttpURLConnection, HttpSession, URL etc...).
    I am able to access login form, but after login when I connect second url, it gives session expired message in the html stream.
    This is because I am not managing session. So can any body have any idea or pointer. How I can manage sesssion and access second page after succesfull login.
    I will appreciate your help.
    Thanks and regards -
    Vikas Kumar Sahu.

    The session is managed as a cookie (JSessionID if I'm not mistaken). So what you need is a way to obtain all cookies from an url and send them back to the server. Apache HttpClient is your best bet:
    http://jakarta.apache.org/commons/httpclient/cookies.html

  • Sub :  How to manage session ?

    Hi Java Gurus,
    Can any body tell me how to manage session in java.
    I have two url say http://www.xyz/userlogin.php, http://www.xyz/sendsms.php
    1st url gives the login form and second one coes after succesfull login.
    Now I am not using any web browser. I have to surf these pages through java code using java api ( HttpURLConnection, HttpSession, URL etc...).
    I am able to access login form, but after login when I connect second url, it gives session expired message in the html stream.
    This is because I am not managing session. So can any body have any idea or pointer. How I can manage sesssion and access second page after succesfull login.
    I will appreciate your help.
    Thanks and regards -
    Vikas Kumar Sahu.

    What I do in some of our test-clients is that I call the login and get all the cookies from the header and add them to the next request.
    More or less what pkwooster suggested.
    Also, I suggest that you take a look at http://jakarta.apache.org/commons/httpclient/
    and the Example code http://svn.apache.org/viewvc/jakarta/commons/proper/httpclient/trunk/src/examples/CookieDemoApp.java?view=markup
    Message was edited by:
    Lajm

  • How to send sms port from Desktop applications to the Midlet?

    how to send sms port from Desktop applications to the Midlet?

    Depends on the API your SMS gateway provides, and may not even be possible. Even if you can send the SMS with a port specified, be aware that some carriers deliver the SMS without the port number, which will result in it going to the device inbox and so won't activate your MIDlet registered with the PushRegistry.
    I understand that you're working on a JavaSE application, but members who frequent the mobility forums might have more knowledge about this. Would you like me to move this thread there?
    db

  • How can one develop "view only" client applications in Lookout?This is to develop remote monitoring without control functionality.

    How can one develop "view only" client applications in Lookout?This is to develop remote monitoring without control functionality.
    We have 10 Client Nodes in the field and we need two "View Only" functionality in Client machines located on Supervisory Desks.

    I have done this. There are many ways to approach this but I will offer what I think is the easiest. This will work ONLY if you have been assigning security levels to your objects (objects that actually control devices in the field) greater than zero AND allowing a security level of zero to view all panels. When I develop interfaces I do this just for creating a non control client.
    Basically, you remove all users from the Lookout client in the user manager. You will not be able to remove the built-ins, "Guest" and "Administrator". Now when the end users tries to login using his normal login he will be denied. Consequently, he will not be able to control. But, he will still be able to view all the information since a no login can view a panel with a viewing se
    curity level of zero. You must ensure any pushbuttons that are used to open panels have a security level of zero.
    Now you can copy this security profile by finding the lookout.sec file and copying it to another non-control client computer. In Windows NT this file is located in the system32 directory.
    There are many other ways but I find this the easiest.
    Regards,
    Tommy Scharmann

  • I am running out of memory on my hard drive and need to delete files. How can I see all the files/applications on my hard drive so I can see what is taking up a lot of room?

    I am running out of memory on my hard drive and need to delete files. How can I see all the files/applications on my hard drive so I can see what is taking up a lot of room?
    Thanks!
    David

    Either of these should help.
    http://grandperspectiv.sourceforge.net/
    http://www.whatsizemac.com/
    Or search 'disk size' in the App Store.
    Be carefull with what you delete & have a backup BEFORE you start, you may also want to reboot to try to free any memory that may have been written to disk.

  • How can I set a third party application to access my organizations intranet through my organizations network

    how can I set a third party application to access my organizations intranet through my organizations network  . I am using blackberry bold 9700 OS 6

    Hi deepajithesh
    This feature is not available. Applications access the BlackBerry Network using the connection to BIS.
    Thanks
    -CptS
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • How can i attach files in oracle applications

    Hi,
    How can i attach files in oracle applications ? Is there any thing like open dialogue box?
    krishna

    Hi Naveen,
    While I am searching for attaching files to oracle forms in forum, I found you. I have a question; probably you could help me out. I have a custom form which needs to have the facility to open the text files from C drive and load the data into Oracle tables.
    The custom form will be attached to Oracle apps responsibility... We are currently using forms6i.
    Could you help me out to open a dialog box which provides the users to open the text files from C drive when user clicks on a button
    I have attached d2kcomm and d2kwutil to the form. It complies at the form level
    but still it is not showing the dialog box.
    I would appreciate if you can help me in this regard.
    Thanks in Advance
    Ravi.
    Message was edited by:
    ravipampana

  • How can I get rid of some applications that I don't want anymore?

    How can I get rid of some applications which I don't want anymore?

    Hold the app icon until it wiggles then tap the "X"
    or
    Settings > General > Usage > select the app > Delete App
    iOS stock apps can not be removed.
    If you do not want them to show up on your devices anymore you can hide the:
    iTunes Store: Hiding and unhiding purchases

  • How can I know the version of Application Server Java Virtual Machine

    How can I know the version of Application Server Java Virtual Machine?
    Thanks a lot.

    Thats easy. Your jdk/jre are located in the App Server home directory. Just run the java command under the jdk directory with the "-version" switch and it will provide you with detailed information about your VM.
    For example if you're doing it at command prompt it will be something like
    java -versionI hope this will be useful to you.
    Regards,
    Wasif

Maybe you are looking for

  • What's happening to my site?!?

    I've designed this site in Photoshop, sliced it up and then exported it to HTML format, then opened up the HTML file for editing in Dreamweaver. Everything looks good and when I go to preview it in Safari, it looks great. So I sent this project out f

  • Reg: Purchase order no from accounting document no

    hi, I have to generate a report of vendor billing details,where i have to get the corresponding purchase order no for accounting document no.From bseg i am getting the ebeln field but i have fetched based on posting key bschl ='86' or '81'.for the co

  • Whom must I contact to get a refund for being double charged?

    I am absolutely infuriated with the lack of HUMAN BEINGS that can help me. I can get support for my phone and talk to a person. But as soon as they realize that my issue is with itunes I am told I HAVE to go through the online support and that they d

  • Attempting to set Screen Saver causes System Preferences to crash

    EVERY time I go to the System Preferences and try to set the Screen Saver, System Preferences crashes I moved the .../user/library/preferences/com.apple.systempreferences.plist.saved and com.apple.systempreferences.plist files out of the directory to

  • [SOLVED] gimp can't open any files - probably an easy fix

    I can't open any files such as .png's or .jpg's in gimp. How can I change this. I installed it via pacman. I don't know if this helps, but I'm running kde. Last edited by itsbrad212 (2010-02-04 01:25:16)