Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By Tolls

Thread: Block url without logging in

  1. #1
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default Block url without logging in

    I have a web page (log in page -username and pass-) where i can use it to redirect me to another pages if the log in done successfully.
    Now the problem if i request the url of those pages i will still able to navigate them. I need mechanism to block and restrict those pages without authentication. User must first log in, and if he request the url of those pages he must be able to navigate them.

    That is very similar to the mechanism of email logging in, you cannot navigate to your email inbox without logging in, even if you have the URL link to your inbox.

    How to do it?

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    837
    Rep Power
    6

    Default Re: Block url without logging in

    u have to write ur own filter.Refer this example.
    JSF 2 Login Filter Example - Programmer's lounge
    Ramya:cool:

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    6

    Default Re: Block url without logging in

    vector_ever,

    That s quite simple. create a session if login is successful. Use the same session in your home page which is supposed as the landing page of successful login.
    Mak
    (Living @ Virtual World)

  4. #4
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default Re: Block url without logging in

    Quote Originally Posted by RamyaSivakanth View Post
    u have to write ur own filter.Refer this example.
    JSF 2 Login Filter Example - Programmer's lounge
    Hi RamyaSivakanth, thank you for the pretty good example, but it is still missing a lot.
    For example i can get the secured pages after log out by using back button, our it is doesn’t work any more if i have servlet-mapping setting in web.xml to change the default path of the pages (as in my case).

    Do you have any other Ideas for those problems?

  5. #5
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default Re: Block url without logging in

    Quote Originally Posted by makpandian View Post
    vector_ever,

    That s quite simple. create a session if login is successful. Use the same session in your home page which is supposed as the landing page of successful login.
    Hi makpandian, thank you for your answer.
    But unfortunately i didn't understand it, can you explain me in more details or if you have example or any tutorials will be geat

    Thanks

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,042
    Rep Power
    20

    Default Re: Block url without logging in

    Quote Originally Posted by vector_ever View Post
    Hi RamyaSivakanth, thank you for the pretty good example, but it is still missing a lot.
    For example i can get the secured pages after log out by using back button, our it is doesn’t work any more if i have servlet-mapping setting in web.xml to change the default path of the pages (as in my case).

    Do you have any other Ideas for those problems?
    Check (using something like Fiddler) whether the browser is making a request to the server.
    If it isn't then the Back button is simply returning a cached page, so you'll need to prevent caching.
    RamyaSivakanth likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    187
    Rep Power
    2

    Default Re: Block url without logging in

    Yes thanks, now it work perfectly

  8. #8
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    6

    Default Re: Block url without logging in

    vector_ever

    Which approach you used to resolve that?
    Mak
    (Living @ Virtual World)

  9. #9
    Join Date
    Apr 2014
    Posts
    49
    Rep Power
    0

Similar Threads

  1. JVM Logging
    By sansana in forum New To Java
    Replies: 2
    Last Post: 07-10-2010, 01:56 AM
  2. Logging applications
    By ravian in forum New To Java
    Replies: 2
    Last Post: 01-02-2008, 06:43 PM
  3. what is logging
    By Thirumalt in forum Java Software
    Replies: 1
    Last Post: 11-26-2007, 11:37 AM
  4. Logging
    By ravian in forum New To Java
    Replies: 3
    Last Post: 11-18-2007, 10:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •