MCPcopy
hub / github.com/Place1/wg-access-server / CurrentUser

Function CurrentUser

pkg/authnz/authsession/session.go:61–68  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

59}
60
61func 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
70func Authenticated(ctx context.Context) bool {
71 _, err := CurrentUser(ctx)

Callers 6

InfoMethod · 0.92
AddDeviceMethod · 0.92
ListDevicesMethod · 0.92
DeleteDeviceMethod · 0.92
ListAllDevicesMethod · 0.92
AuthenticatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected