Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

75%
+4 −0
Q&A How to properly deal with impersonation in a Web application? (security vs. usefulness for tech support)

My first instinct would be to track both identities, using one for access control, and the other for audit purposes. For instance, rather than storing: User createdBy; you'd store User create...

posted 3y ago by meriton‭

Answer
#1: Initial revision by user avatar meriton‭ · 2021-04-08T19:00:51Z (over 3 years ago)
My first instinct would be to track *both* identities, using one for access control, and the other for audit purposes. 

For instance, rather than storing:

    User createdBy;

you'd store

    User createdBy; // for auditing
    User createdOnBehalfOf; // for access control

All access control logic would use `createdOnBehalf`, but the UI would show both, for instance like "created by ArtOfCode on behalf of meriton".

    
This makes impersonation transparent, while allowing the impersonator to use the application exactly like the impersonated user.

This is a pretty standard approach. For instance, when you send a mail in outlook on behalf of someone else, you see something like "From: Sue on behalf of Joe". Similarly, git tracks both the author and committer for every commit, clearly separating the person responsible for the content from the person responsible for its existence in a particular branch.

Of course, if tech support is the only reason for the existence of this impersonation feature, simpler solutions may exist. For instance, tech support could remote control the user's desktop using team viewer, thus ensuring impersonation happens only with the knowledge and consent of the person being impersonated.