IdentityFromContext returns the resolved Identity, or nil if unauthenticated.
(c *gin.Context)
| 61 | Source string `json:"source"` |
| 62 | } |
| 63 | |
| 64 | // IdentityFromContext returns the resolved Identity, or nil if unauthenticated. |
| 65 | func IdentityFromContext(c *gin.Context) *Identity { |
| 66 | v, ok := c.Get(ctxIdentityKey) |
| 67 | if !ok { |
| 68 | return nil |
| 69 | } |
| 70 | id, _ := v.(*Identity) |
| 71 | return id |
| 72 | } |
| 73 |