点击标题进入github
请按照以下步骤运行示例应用程序:
- 运行以下命令以启动hello-service:
./gradlew :hello-service:bootRun
|
- 在新终端中,运行以下命令将请求发送到不安全的hello端点:
./gradlew :hello-client:bootRun --args="hello Bob"
|
如果成功,您将看到以下响应:2019-12-18 11:02:55.038 INFO 3540 --- [ main] e.client.hello.HelloClientApplication : Sending message without Basic Auth metadata... 2019-12-18 11:02:55.065 INFO 3540 --- [ main] e.client.hello.HelloClientApplication : Response: Hello, Bob, from unsecured method
|
- 接下来,运行以下命令将请求发送到安全hello.secure端点:
./gradlew :hello-client:bootRun --args="hello.secure Bob"
|
您将收到一个,io.rsocket.exceptions.ApplicationErrorException: Access Denied因为您没有提供有效的替代。 - 接下来,运行以下命令将请求发送到安全hello.secure端点,但是这次提供有效的替代:
./gradlew :hello-client:bootRun --args="--username=admin --password=password hello.secure Bob"
|
如果成功,您将看到以下响应: 2019-12-18 11:07:12.171 INFO 3575 --- [ main] e.client.hello.HelloClientApplication : Sending message with Basic Auth metadata... 2019-12-18 11:07:12.284 INFO 3575 --- [ main] e.client.hello.HelloClientApplication : Response: Hello, Bob, from secured method
|