GetUser returns the authenticated user from the echo context, or nil.
(c echo.Context)
| 203 | |
| 204 | // GetUser returns the authenticated user from the echo context, or nil. |
| 205 | func GetUser(c echo.Context) *User { |
| 206 | u, ok := c.Get(contextKeyUser).(*User) |
| 207 | if !ok { |
| 208 | return nil |
| 209 | } |
| 210 | return u |
| 211 | } |
| 212 | |
| 213 | // GetUserRole returns the role of the authenticated user, or empty string. |
| 214 | func GetUserRole(c echo.Context) string { |