You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: update security examples to YAML, improve clarity in OAuth2 and JWT configurations
- Migrated security examples from Groovy to YAML for readability and consistency.
- Refined API flows and comments for `apikey-to-jwt-conversion` and OAuth2 examples.
- Enhanced documentation in `README.md` with clear descriptions of API key, JWT, and OAuth2 usage.
* docs: fix broken link to Prometheus and Grafana example in README.md
* fix: correct indentation in OAuth2 example and typo in README
Copy file name to clipboardExpand all lines: README.md
+56-55Lines changed: 56 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -869,80 +869,81 @@ api:
869
869
870
870
# Security
871
871
872
-
Membrane offers lots of security features to protect backend servers.
872
+
Membrane offers all kinds of security features to protect APIs and backend servers.
873
873
874
874
## API Keys
875
875
876
-
You can define APIs keys directly in your configuration, and Membrane will validate incoming requests against them.
876
+
API keys can be defined in the configuration, loaded from a file, or stored in a database. Requests are authenticated by validating the provided API key against these sources.
877
877
878
-
### Example Configuration
879
-
The following configuration secures the `Fruitshop API` by validating an API key provided as a query parameter:
878
+
You can also define permissions using scopes in OpenAPI and enforce them with API keys, OAuth 2.0, or JWT-based authentication.
880
879
881
-
```xml
882
-
<api port="2000">
883
-
<apiKey>
884
-
<!-- Define valid API keys -->
885
-
<simple>
886
-
<secret value="abc123" />
887
-
<secret value="secret" />
888
-
<secret value="Paris2025" />
889
-
</simple>
890
-
891
-
<!-- Extract the API key from the query parameter -->
892
-
<queryParamExtractor paramName="api-key" />
893
-
</apiKey>
894
-
<target url="https://api.predic8.de" />
895
-
</api>
896
-
```
880
+
This configuration secures all APIs globally. Alternatively, API keys can be defined for individual APIs only.
897
881
898
-
### Testing the Configuration
899
-
To test the configuration, pass a valid API key in the query string:
If the key is invalid or missing, Membrane denies access and returns an error response (HTTP 401 Unauthorized).
898
+
More advanced scenarios are supported, including:
906
899
907
-
### Advanced Use Cases
908
-
For more complex setups, such as API keys in the HTTP header, role-based access control (RBAC) or file-based key storage, see the [API Key Plugin Examples](./distribution/examples/security/api-key/rbac/README.md).
900
+
- API keys in headers, query parameters or at any other location using expressions.
901
+
- Role-based access control (RBAC) with fine-grained permissions.
902
+
- OpenAPI-defined permissions.
903
+
904
+
See the [API Key Plugin Examples](./distribution/examples/security/api-key/rbac/README.md) for detailed configurations.
909
905
910
906
## JSON Web Tokens
911
907
912
-
The API below only allows requests with valid tokens from Microsoft's Azure AD. You can also use the JWT validator for other identity providers.
908
+
The API below only allows requests that present a valid JSON Web Token issued by Microsoft Azure Entra ID. The JWT validator can also be used with other identity providers.
Try the tutorial [OAuth2 with external OpenID Providers](https://membrane-soa.org/api-gateway-doc/current/oauth2-openid.html)
@@ -1156,7 +1157,7 @@ This API will expose metrics for Prometheus at [http://localhost:2000/metrics](h
1156
1157

1157
1158
Grafana dashboard from Membrane metrics.
1158
1159
1159
-
See [Prometheus and Grafana example](distribution/examples/monitoring-tracing/prometheus).
1160
+
See [Prometheus and Grafana example](distribution/examples/monitoring-tracing/prometheus-grafana).
1160
1161
1161
1162
### OpenTelemetry Integration
1162
1163
Membrane supports integration with **OpenTelemetry** traces using the `openTelemetry` plugin and the `W3C` propagation standard. This enables detailed tracing of requests across Membrane and backend services.
0 commit comments