Getting more attributes from CAS than just user id

前端 未结 5 1301
青春惊慌失措
青春惊慌失措 2021-01-04 04:29

I am using CAS with JDBC Authentication handler and was wondering is it possible to get the other attributes of principal object (for e.g. firstname, lastname) not just the

5条回答
  •  醉话见心
    2021-01-04 04:48

    The definitive and complete solution is the following (for this undocumented feature):

    1. Server side:

      a. Add an attributeRepository to your CredentialsToPrincipalResolver.

      b. Implement the your.package.YourPersonAttributeDao like an IPersonAttributeDao.

      c. Declare the attributes that will be transmitted into assertion to client.

      d. Modify the casServiceValidationSuccess.jsp to display the attributes (thx to xiongjiabin).

    2. Client side. You get all attributes by doing this:

      Due to formatting problem I can't post the code of the definitive solution.... Let me know if you are interested, I will send you an email with all the code.

提交回复
热议问题