Skip to content

feat: show how to secure api by using scope#81

Merged
jsinovassin merged 2 commits intomasterfrom
add-protection-with-scope-example
Feb 18, 2026
Merged

feat: show how to secure api by using scope#81
jsinovassin merged 2 commits intomasterfrom
add-protection-with-scope-example

Conversation

@jsinovassin
Copy link
Contributor

@jsinovassin jsinovassin commented Feb 17, 2026

This pull request introduces a new sample module, protected-servlet-sample, demonstrating how to declare and protect a servlet with OSGi and Jahia's security filter. The module provides a servlet with scoped API endpoints and includes configuration for permission management.

New sample module addition:

  • Added protected-servlet-sample as a new Maven module in the project.

Servlet implementation and security:

  • Implemented SampleServlet in protected-servlet-sample/src/main/java/org/sample/modules/sampleservlet/SampleServlet.java, providing API endpoints (sayHello, sayHi, sayBye) and enforcing access control using Jahia's PermissionService.

Authorization configuration:

  • Added org.jahia.bundles.api.authorization-sample.yaml in protected-servlet-sample/src/main/resources/META-INF/configurations to define the sampleScope permission, restricting access to the servlet APIs to admin users.

@jsinovassin jsinovassin force-pushed the add-protection-with-scope-example branch from 44360c2 to 7f80e45 Compare February 17, 2026 16:23
@jsinovassin jsinovassin self-assigned this Feb 18, 2026
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add some comments here to explain values and options ?

@jsinovassin jsinovassin merged commit 0604e66 into master Feb 18, 2026
11 checks passed
@jsinovassin jsinovassin deleted the add-protection-with-scope-example branch February 18, 2026 16:53
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.

Support additional url patterns for Personal API Tokens via a configuration factory

2 participants