MCPcopy Create free account
hub / github.com/ericls/imgdd / AuthenticateContext

Method AuthenticateContext

httpserver/identity.go:108–120  ·  view source on GitHub ↗
(c context.Context, userId string, organzationUserId string)

Source from the content-addressed store, hash-verified

106}
107
108func (i *IdentityManager) AuthenticateContext(c context.Context, userId string, organzationUserId string) {
109 w := GetResponseWriter(c)
110 r := GetRequest(c)
111 // Set authentication info on the session for next requests
112 i.Authenticate(w, r, userId, organzationUserId)
113 user := i.IdentityRepo.GetUserById(userId)
114 orgUser := i.IdentityRepo.GetOrganizationUserById(organzationUserId)
115 // Set authentication info on the context for this request
116 i.ContextUserManager.SetAuthenticationInfo(c, &identity.AuthenticationInfo{
117 AuthenticatedUser: &identity.AuthenticatedUser{User: user},
118 AuthorizedUser: &identity.AuthorizedUser{OrganizationUser: orgUser},
119 })
120}
121
122func (i *IdentityManager) LogoutContext(c context.Context) {
123 authContext := i.ContextUserManager.GetAuthenticationInfo(c)

Callers 2

TestLoginLogoutFunction · 0.95

Calls 6

AuthenticateMethod · 0.95
GetResponseWriterFunction · 0.85
GetRequestFunction · 0.85
GetUserByIdMethod · 0.65
SetAuthenticationInfoMethod · 0.65

Tested by 2

TestLoginLogoutFunction · 0.76