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);
如图:
把每一件简单的事情做好,就是不简单;把每一件平凡的事情做好,就是不平凡!相信自己,创造奇迹~~