欢迎访问我的个人网站==》 jiashubing.cn

CAS客户端添加用户信息-Assertion添加自定义属性

错误的写法

这种只是写 threadLocal,并没有写到 redis 里去,要想写到 redis 里

Assertion assertion = AssertionHolder.getAssertion();
assertion.getPrincipal().getAttributes().put("ccc", "ddd");
AssertionHolder.setAssertion(assertion);

正确的写法

ISessionStore sessionStore = SessionStoreFactory.getSessionStore();
Assertion assertion = AssertionHolder.getAssertion();
assertion.getPrincipal().getAttributes().put("ccc", "ddd");
sessionStore.setAssertion(username, assertion);

如图:

 

posted @ 2023-06-21 16:11  贾树丙  阅读(211)  评论(0编辑  收藏  举报