Skip to content

Commit

Permalink
fix: fix examples for the new "security at operation level" feature (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sekharbans-ebay authored Apr 26, 2022
1 parent e285fb4 commit 5856082
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions examples/streetlights-operation-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ defaultContentType: application/json
channels:
smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured:
description: The topic on which measured values may be produced and consumed.
servers:
- test
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
Expand All @@ -46,10 +48,10 @@ channels:
- $ref: '#/components/operationTraits/kafka'
message:
$ref: '#/components/messages/lightMeasured'
security:
streetlights_auth:
- streetlights:write

smartylighting.streetlights.1.0.action.{streetlightId}.turn.on:
servers:
- test_oauth
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
Expand All @@ -60,14 +62,16 @@ channels:
message:
$ref: '#/components/messages/turnOnOff'
security:
# This operation level security implies the ability to send a message to
# `smartylighting.streetlights.1.0.action.{streetlightId}.turn.on` with Authorization headers
# with `streetlights:read` scope. It is also possible for the same channel when using `test_auth`
# server to instead use credentials for security (scramSha256 in this example) specified on the server level
streetlights_auth:
- streetlights:read
# This operation level security implies the ability to subscribe to messages from
# `smartylighting.streetlights.1.0.action.{streetlightId}.turn.on` channel with Authorization headers
# that have `streetlights:read` scope. Note that an operation level security must still satisfy
# security requirements specified at the server level.
- streetlights_auth:
- streetlights:read

smartylighting.streetlights.1.0.action.{streetlightId}.turn.off:
servers:
- test_oauth
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
Expand All @@ -78,9 +82,15 @@ channels:
message:
$ref: '#/components/messages/turnOnOff'
security:
streetlights_auth:
- streetlights:read
# This operation level security implies the ability to subscribe to messages from
# `smartylighting.streetlights.1.0.action.{streetlightId}.turn.off` channel with Authorization headers
# that have `streetlights:read` scope. Note that an operation level security must still satisfy
# security options specified at the server level.
- streetlights_auth:
- streetlights:read
smartylighting.streetlights.1.0.action.{streetlightId}.dim:
servers:
- test_oauth
parameters:
streetlightId:
$ref: '#/components/parameters/streetlightId'
Expand All @@ -91,12 +101,12 @@ channels:
message:
$ref: '#/components/messages/dimLight'
security:
# This operation level security implies the ability to send a message to
# `smartylighting.streetlights.1.0.action.{streetlightId}.turn.on` with Authorization headers
# with `streetlights:read` scope. It is also possible for the same channel when using `test_auth`
# server to instead use credentials for security (scramSha256 in this example) specified on the server level
streetlights_auth:
- streetlights:read
# This operation level security implies the ability to subscribe to messages from
# `smartylighting.streetlights.1.0.action.{streetlightId}.dim` channel with Authorization headers
# that have `streetlights:read` scope. Note that an operation level security must still satisfy
# security options specified at the server level.
- streetlights_auth:
- streetlights:read


components:
Expand Down

0 comments on commit 5856082

Please sign in to comment.