|
I have taken the approach of creating a session table after the user
authenticates initially.
In the table I usually store the userid, generated session id (guid) a
source IP address (can be spoofed, but harder to do) and any other session
related values I might want in there.
The session ID and source IP info is usually enough to constitute a valid
session (unless IP spoofed) unless you're a banking institution where that
might not hold up.
If a hit comes in that's not from a valid session id/ip combo the session
is immediately removed from the table and session invalidated on next
attempt to access a page or data.
The same concept also works nicely when you want to limit the number of
users logged into an app for a particular user ID.
If user logs in a second time from another device you can invalidate their
first session.
Feel free to poke holes in this strategy.
I'm always looking for better options and of course OAuth seems to be one
of those these days.
Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
------------------------------
message: 4
date: Thu, 30 Jan 2020 16:13:20 -0700
from: Nathan Andelin <nandelin@xxxxxxxxx>
subject: Re: [WEB400] Apache authentication efficiency
On Thu, Jan 30, 2020 at 4:00 PM B Stone <bvstone@xxxxxxxxx> wrote:
Would you be against rolling your own using cookies/tokens?
Just about everyone in the world does that. But it doesn't address the
original question of checking the user's credentials and checking their
authority to resources on every request ;-)
If you go that route, the token that you generate (and carry from request
to request) needs to be secure enough that no other client can duplicate it.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.