cn.antcore.security.helper.SessionStringRedisSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boot-starter-security Show documentation
Show all versions of spring-boot-starter-security Show documentation
This is spring-boot-starter-security.
The newest version!
package cn.antcore.security.helper;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
*
*
* Created by Hong.
* 2021/3/24
**/
public class SessionStringRedisSerializer extends StringRedisSerializer {
private String prefix() {
return "session:";
}
@Override
public String deserialize(byte[] bytes) {
String str = super.deserialize(bytes);
str = str.substring(prefix().length());
return str;
}
@Override
public byte[] serialize(String string) {
return super.serialize(prefix() + string);
}
}