(ctx context.Context)
| 59 | } |
| 60 | |
| 61 | func CurrentUser(ctx context.Context) (*Identity, error) { |
| 62 | if session, ok := ctx.Value(sessionKey).(*AuthSession); ok { |
| 63 | if session.Identity != nil { |
| 64 | return session.Identity, nil |
| 65 | } |
| 66 | } |
| 67 | return nil, errors.New("unauthenticated") |
| 68 | } |
| 69 | |
| 70 | func Authenticated(ctx context.Context) bool { |
| 71 | _, err := CurrentUser(ctx) |
no outgoing calls
no test coverage detected