Changes for page Версія 6: Налаштування
Last modified by Ashterix on 2024/07/11 10:08
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - 2.Bundle config1 +Bundle config - Content
-
... ... @@ -126,7 +126,7 @@ 126 126 127 127 public function __construct(protected UserService $userService) {} 128 128 129 - public function isValid(string $token): true129 + public function isValid(string $token): bool 130 130 { 131 131 try { 132 132 this.userService.getUserByToken(token); ... ... @@ -159,24 +159,6 @@ 159 159 class: App\Services\RpcSecurity\UserTokenValidator 160 160 {{/code}} 161 161 162 -= Block {{code language="none"}}async{{/code}} = 163 - 164 -This block is for configuring [[asynchronous transport>>doc:docs.JsonRpcBundle.functionality.async.WebHome]]. 165 - 166 -Add the parameter {{code language="none"}}rpc_async{{/code}} which contains a string in DSN format. This string is the configuration for [[Symfony Messenger>>https://symfony.com/doc/current/messenger.html]], and it points to the asynchronous transport where the RPC Server will be waiting for incoming requests if you have a consumer running ({{code language="none"}}php bin/console messenger:consume rpc_async{{/code}}). For a more detailed understanding of this process, read the [[Symfony Messenger documentation>>https://symfony.com/doc/current/messenger.html]]. 167 - 168 -{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}} 169 -ufo_json_rpc: 170 - async: 171 - rpc_async: '%env(resolve:RPC_TRANSPORT_DSN)%' 172 - 173 -{{/code}} 174 - 175 -(% class="box warningmessage" %) 176 -((( 177 -This configuration implies that you have an environment variable RPC_TRANSPORT_DSN set, which contains the DSN string. 178 -))) 179 - 180 180 = The {{code language="none"}}docs{{/code}} block = 181 181 182 182 This block configures the generation of documentation when you make a GET request on the RPC Server ... ... @@ -209,65 +209,6 @@ 209 209 key_for_methods: some_custom_key 210 210 {{/code}} 211 211 212 -=== Parameter {{code language="none"}}async_dsn_info{{/code}} === 213 - 214 -Responsible for displaying information about asynchronous transport in the documentation. 215 - 216 -{{code language="yaml" layout="LINENUMBERS" title="config/packages/ufo_json_rpc.yaml"}} 217 -ufo_json_rpc: 218 - async_dsn_info: true # or false 219 -{{/code}} 220 - 221 -==== **Documentation Example** ==== 222 - 223 -{{code language="json" layout="LINENUMBERS" title="GET: /api"}} 224 -{ 225 - "envelope": "JSON-RPC-2.0/UFO-RPC-6", 226 - "contentType": "application/json", 227 - "description": "", 228 - "transport": { 229 - "sync": { 230 - "scheme": "http", 231 - "host": "example.com", 232 - "path": "/api", 233 - "method": "POST" 234 - }, 235 - "async": { 236 - "scheme": "amqp", 237 - "user": "{user}", 238 - "pass": "{pass}", 239 - "host": "async_rabbit", 240 - "port": 5672, 241 - "path": "/%2f/json-rpc" 242 - } 243 - }, 244 - "methods": { 245 - ... 246 - } 247 -} 248 -{{/code}} 249 - 250 -{{info}} 251 -Do not worry about the security of your authorization data contained in the DSN. 252 - 253 -The documenter is designed in such a way that before displaying DSN information, it removes user data and passwords, as well as other sensitive information, such as tokens, secret keys, etc. 254 - 255 -The template for protecting data is {{code language="none"}}/([\w\d_]*(?:secret|access|token|key)[_\w]*)=((?:\w|\d)+(?=&?))/{{/code}}. 256 - 257 -Example: 258 - 259 -{{code language="json" layout="LINENUMBERS" title="RPC_TRANSPORT_DSN=https://sqs.eu-west-3.amazonaws.com/123456789012/messages?access_key=AKIAIOSFODNN7EXAMPLE&secret_key=j17M97ffSVoKI0briFoo9a"}} 260 -{ 261 - "async": { 262 - "scheme": "https", 263 - "host": "sqs.eu-west-3.amazonaws.com", 264 - "path": "/123456789012/messages", 265 - "query": "access_key={access_key}&secret_key={secret_key}" 266 - } 267 -} 268 -{{/code}} 269 -{{/info}} 270 - 271 271 === Parameter {{code language="none"}}validations{{/code}} === 272 272 273 273 Responsible for displaying in the documentation methods additional blocks that indicate data validation requirements. ... ... @@ -292,10 +292,11 @@ 292 292 (% class="box infomessage" %) 293 293 ((( 294 294 In this example, I removed the content of the objects symfony_assertions to simplify the example. 295 -For more information on method validation, see the page **[[Validate procedures>>doc: docs.JsonRpcBundle.add_rpc_service.assertions.WebHome]]**218 +For more information on method validation, see the page **[[Validate procedures>>doc:.add_rpc_service.assertions.WebHome]]** 296 296 ))) 297 297 298 -{{code language="json" layout="LINENUMBERS" title="GET: /api"}} 221 +{{code language="json" layout="LINENUMBERS" title=" 222 +GET: /api"}} 299 299 { 300 300 "envelope": "JSON-RPC-2.0/UFO-RPC-6", 301 301 "transport": "POST",