You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by al...@apache.org on 2023/04/27 09:33:00 UTC
[dubbo-samples] branch master updated: Spring security change doc (#830)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 9e01c5a7 Spring security change doc (#830)
9e01c5a7 is described below
commit 9e01c5a79bbf3ba24709026cb6cc11ac190b62da
Author: jojocodeX <57...@qq.com>
AuthorDate: Thu Apr 27 17:32:55 2023 +0800
Spring security change doc (#830)
* add spring security samples
* add spring security samples
* add readme
* remove unused code
* readme change
* add readme
* add readme
* readme change
* Add ASF license header
* CI run
* Change dubbo spring security doc
* Change dubbo spring security doc
* Change dubbo spring security doc
* format
* format
---
.../src/main/resources/readme.md | 15 +++++++++++++++
.../src/main/resources/readme_zh.md | 18 ++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/2-advanced/dubbo-samples-spring-security/src/main/resources/readme.md b/2-advanced/dubbo-samples-spring-security/src/main/resources/readme.md
index 060c8862..6ace78f4 100644
--- a/2-advanced/dubbo-samples-spring-security/src/main/resources/readme.md
+++ b/2-advanced/dubbo-samples-spring-security/src/main/resources/readme.md
@@ -62,11 +62,26 @@ public class SecurityConfiguration {
### custom serialization
++ In the resources directory, add `/META-INF/dubbo/` directory.
++ Add a configuration file, filename ` org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer` .
++ File contents `customizerConfigurationObjectMapperCodecCustomer=org.apache.dubbo.samples.custom.DefaultObjectMapperCodecCustomer`.
++ Implementation code
+
```java
public class DefaultObjectMapperCodecCustomer implements ObjectMapperCodecCustomer {
@Override
public void customize(ObjectMapperCodec objectMapperCodec) {
+ //Add custom codec
}
}
```
+#### notes
+
++ Most implementations of Authentication objects for Spring Security use a parameterized constructor. If you customize the Authentication object and use a parameterized constructor, you must register the deserializer for the ObjectMapper when deserializing.In a Dubbo application, you can use the ObjectMapperCodecCustomer extension to customize the serialization and deserialization of objects。
+
++ If you do not have a custom implementation of deserializer errors, Dubbo ignores the current error
+
++ In spring security, custom deserialization implementation references `UsernamePasswordAuthenticationTokenDeserializer`
+
+
diff --git a/2-advanced/dubbo-samples-spring-security/src/main/resources/readme_zh.md b/2-advanced/dubbo-samples-spring-security/src/main/resources/readme_zh.md
index bbd5be28..93c10e00 100644
--- a/2-advanced/dubbo-samples-spring-security/src/main/resources/readme_zh.md
+++ b/2-advanced/dubbo-samples-spring-security/src/main/resources/readme_zh.md
@@ -62,11 +62,29 @@ public class SecurityConfiguration {
### 自定义序列化
++ 在 resources 目录下,添加 `/META-INF/dubbo/` 目录。
++ 添加配置文件,文件名 ` org.apache.dubbo.spring.security.jackson.ObjectMapperCodecCustomer` 。
++ 文件内容 `customizerConfigurationObjectMapperCodecCustomer=org.apache.dubbo.samples.custom.DefaultObjectMapperCodecCustomer` 。
++ 自定义实现代码
+
```java
public class DefaultObjectMapperCodecCustomer implements ObjectMapperCodecCustomer {
@Override
public void customize(ObjectMapperCodec objectMapperCodec) {
+
+ //Add custom codec
}
}
```
+#### 备注:
+
++ 大多数Spring Security的Authentication对象实现都使用了带参数的构造函数。如果您要自定义Authentication对象并使用带参数的构造函数,那么在反序列化时必须为ObjectMapper注册反序列化器。在Dubbo应用中,你可以扩展ObjectMapperCodecCustomer注册序列化和反序列化对象。
+
++ 如果没有自定义实现反序列化器产生的错误,dubbo 会忽略当前错误
+
++ 在Spring Security 中,自定义反序列器可以参考`UsernamePasswordAuthenticationTokenDeserializer`
+
+
+
+
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org