Hi Denis,

I'm not sure if I understand your question correctly, but it seems to me 
that you need a context with user specific data. Therefore, I would create 
a handler that will add the current user to the context and then you can 
access it in every handler where you need it. User of your site must be 
identified by a token or cookie, normally this also known as session 
handling. There are several libraries that can be used for such kind of 
task see:

- https://pkg.go.dev/github.com/gorilla/sessions
- https://github.com/alexedwards/scs

Keep in mind that you do not store sensitive data in cookies, user 
identities must be kept on server and stored in a save manner.
One can use signed JWT tokens to store an users identity within the clients 
browser. 

Hope this helps

Cheers

muhorto...@gmail.com schrieb am Dienstag, 12. Oktober 2021 um 10:28:00 
UTC+2:

> Hi, I have a question that is difficult for me to describe, but at the 
> level of fundamental questions about creating a web service. I have a 
> problem that if a user logs into a profile, then another user will also get 
> into his profile. Generally speaking, this is the property of any person 
> who visits the site. I see a solution to the problem in two ways. I do not 
> know if it is possible to somehow track connections and give each IP its 
> own routine in which it worked. Or dynamic pages that can only be accessed 
> if the request is successful. But again, some data in the structures may 
> change due to another user logged into the profile. Maybe there is some 
> other solution to this problem. I want to understand how it works on the 
> web.
> My project just in case: https://github.com/MukhortovDenis/goproject
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9ac34974-ad5e-4705-ba67-380ddcca1ca4n%40googlegroups.com.

Reply via email to