golem-add-http-auth-moonbit

Enables OIDC authentication on HTTP endpoints in MoonBit Golem agents.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-add-http-auth-moonbit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-add-http-auth-moonbit
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/moonbit/golem-add-http-auth-moonbit
Command: npx skills add https://github.com/golemcloud/golem --skill golem-add-http-auth-moonbit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Securing HTTP endpoints in MoonBit Golem agents requires knowing the correct derive attributes and deployment configuration, and misconfiguration can leave endpoints unintentionally public or block legitimate access.

Core Features & Use Cases

  • Mount-Level Authentication: Apply #derive.mount_auth(true) on an agent struct to require authentication for all of its endpoints at once.
  • Per-Endpoint Control: Use #derive.endpoint_auth to enable or disable auth on individual endpoints, overriding the mount-level setting for cases like public health checks.
  • Principal Injection: Add a Principal parameter to constructors or endpoint methods to receive the authenticated caller's identity automatically.
  • Use Case: You are building a MoonBit agent with a public /health endpoint and private /data endpoints. This Skill shows how to require auth by default, exempt the health check, and configure the OIDC security scheme in golem.yaml.

Quick Start

Ask the AI to add authentication to the HTTP endpoints of your MoonBit Golem agent and configure the security scheme in golem.yaml.

Frequently Asked Questions about golem-add-http-auth-moonbit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add authentication to HTTP endpoints in a MoonBit Golem agent?

Set #derive.mount_auth(true) on the agent struct to require authentication for all endpoints, or use #derive.endpoint_auth(true) on individual endpoint methods. Then configure a security scheme in golem.yaml under httpApi deployments.

How do I make one endpoint public when mount-level auth is enabled?

Add #derive.endpoint_auth(false) to that specific endpoint method. Per-endpoint endpoint_auth settings override the mount-level mount_auth configuration, so a health check can stay public while other endpoints require auth.

How do I access the authenticated user identity in a Golem agent?

Add a Principal parameter to the agent's new constructor or to endpoint methods. The Golem SDK automatically injects the authenticated principal value when auth is enabled on the endpoint.

What happens if I don't specify mount_auth on a MoonBit agent?

Authentication defaults to disabled when #derive.mount_auth is not specified. All endpoints will be publicly accessible unless you explicitly enable auth at the mount or endpoint level.

Can I test Golem endpoint authentication without a production OIDC provider?

Yes. In golem.yaml, use testSessionHeaderName (for example X-Test-Auth) on the agent deployment instead of a securityScheme. This lets you simulate authenticated requests during local development.