(r *http.Request)
| 61 | } |
| 62 | |
| 63 | func (i *IdentityManager) makeAuthenticationInfoFromRequest(r *http.Request) *identity.AuthenticationInfo { |
| 64 | authenticatedUserId, err := i.Persister.Get(r, authenticated_user_id_session_key) |
| 65 | if err != nil { |
| 66 | return nil |
| 67 | } |
| 68 | authorizedUserId, err := i.Persister.Get(r, authroized_user_id_session_key) |
| 69 | if err != nil { |
| 70 | return nil |
| 71 | } |
| 72 | authenticatedUser := identity.AuthenticatedUser{} |
| 73 | authorizedUser := identity.AuthorizedUser{} |
| 74 | if authenticatedUserId != "" { |
| 75 | authenticatedUser.User = i.IdentityRepo.GetUserById(authenticatedUserId) |
| 76 | } |
| 77 | if authorizedUserId != "" { |
| 78 | authorizedUser.OrganizationUser = i.IdentityRepo.GetOrganizationUserById(authorizedUserId) |
| 79 | } |
| 80 | authenticationInfo := identity.AuthenticationInfo{ |
| 81 | AuthenticatedUser: &authenticatedUser, |
| 82 | AuthorizedUser: &authorizedUser, |
| 83 | } |
| 84 | return &authenticationInfo |
| 85 | } |
| 86 | |
| 87 | func (i *IdentityManager) Middleware(next http.Handler) http.Handler { |
| 88 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
no test coverage detected