Skip to content

RHCLOUD-47155 Add guide for protecting API endpoints with Kessel#108

Merged
josejulio merged 4 commits into
project-kessel:mainfrom
josejulio:RHCLOUD-47155
Jun 12, 2026
Merged

RHCLOUD-47155 Add guide for protecting API endpoints with Kessel#108
josejulio merged 4 commits into
project-kessel:mainfrom
josejulio:RHCLOUD-47155

Conversation

@josejulio

Copy link
Copy Markdown
Contributor

Summary

Adds a comprehensive how-to guide for protecting API endpoints using Kessel's authorization system.

What's included

  • Permission schema definition - How to define service permissions in KSL
  • SDK initialization - Client setup across all 5 supported languages (Go, Python, Node.js, Ruby, Java)
  • Permission checks - When to use Check() vs CheckForUpdate() with consistency guarantees
  • Middleware integration - Framework-specific examples (HTTP, Flask, FastAPI, Express, Sinatra, Spring Boot)
  • Error handling - Fail-closed security pattern with examples

Code quality

  • All code examples verified and smoke-tested
  • Proper imports and type signatures for each language
  • Synchronized tabs for easy language switching
  • Links to related concept documentation (consistency model, relationships)

Related

Part of RHCLOUD-47155

🤖 Generated with Claude Code

Adds protect-endpoint.mdx how-to guide covering:
- Defining service permissions in KSL schema
- Initializing Kessel SDK clients across all supported languages
- Implementing Check() and CheckForUpdate() permission checks
- Integrating with web framework middleware patterns
- Error handling with fail-closed security

Includes complete code examples for Go, Python, Node.js, Ruby, and Java
with proper imports, type signatures, and SDK method calls. Examples are
organized in synchronized tabs for easy language switching.

Links to related concept pages (consistency model, relationships) and
uses LinkCard components for next steps navigation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@josejulio josejulio changed the title Add guide for protecting API endpoints with Kessel RHCLOUD-47155 Add guide for protecting API endpoints with Kessel Jun 10, 2026
Updates terminology and code patterns to match the kessel-examples repository:

- Schema: notifications.ksl → myservice.ksl with @rbac.add_unified_permission
- Permissions: notifications_integrations_* → myservice_integration_*
- Resource naming: integrations (plural) → integration (singular)
- Verbs: read/write → view/edit
- Node.js: Add Allowed enum import and use Allowed.ALLOWED_TRUE

All code examples now use identical patterns to the working examples in
kessel-examples/examples/protect-endpoint, enabling seamless transition
from guide to runnable code.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Refactors protect-endpoint guide to use the CodeExamples component pattern:

- Created src/examples/protect-endpoint/ with middleware examples for all 5 languages
- Uses region markers (setup, middleware, usage) consistently across all languages
- Reduces MDX file size by 437 lines
- Improves maintainability: code examples are now in runnable files
- Follows same pattern as other guides (enable-tls, getting-started)
- Adds link to complete example files in repository
- Standardizes on 'TypeScript' label instead of 'Node.js'

This makes the examples easier to test and maintain as standalone code.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@lennysgarage lennysgarage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guide reads really well, feels easy to follow and build on. Just left a few comments on some things I found

Comment thread src/content/docs/building-with-kessel/how-to/protect-endpoint.mdx Outdated
Comment thread src/content/docs/building-with-kessel/how-to/protect-endpoint.mdx Outdated
Co-authored-by: Jonathan Marcantonio <lennysgarage1@gmail.com>

@lennysgarage lennysgarage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@josejulio josejulio merged commit 9d7654d into project-kessel:main Jun 12, 2026
1 check passed
@josejulio josejulio deleted the RHCLOUD-47155 branch June 12, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants