Nexus
1.x
Docs/Nexus/Identity & Auth
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/concepts/identity.mdx

Auth Interface01

type Provider interface {
    Authenticate(ctx context.Context) (Claims, error)
    AuthenticateAPIKey(ctx context.Context, apiKey string) (Claims, error)
}

Claims02

type Claims struct {
    TenantID string
    Subject  string
    Scopes   []string
}

Default (Noop)03

By default, Nexus uses a noop auth provider that allows all requests:

gw := nexus.New() // auth.NewNoop() is set automatically

API Key Auth04

Use the built-in key service for API key authentication:

keyService := key.NewService(store)
gw := nexus.New(
    nexus.WithAuth(keyService),
)

Authsome Adapter05

If you use Authsome in a Forge application, Nexus provides an adapter:

import "github.com/xraph/nexus/auth/authsome"

adapter := authsome.NewAdapter(authsomeInstance)
gw := nexus.New(
    nexus.WithAuth(adapter),
)