Pac4j Retrieve attribute and passing to CAS client

76 views
Skip to first unread message

uvaraj s

unread,
Mar 14, 2018, 10:31:04 PM3/14/18
to CAS Community
Hi,

We are using CAS 4.1.2 and pac4j 1.7 version. We are making SAML2Client call to shibboleth. These question might look like very basic ones. But the answer to these will help us a lot.

1.On the logs, I am able to see the attribute details getting printed. But wanted to know how we can able to retrieve user profile details in the code?.
2.How does client application who uses this CAS server will be able to get these attribute details?

Thanks a lot in Advance.

Jérôme LELEU

unread,
Mar 16, 2018, 11:34:51 AM3/16/18
to CAS Community

--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/7aee0ca9-4edd-48af-848f-c9cc7206cd58%40apereo.org.

uvaraj s

unread,
Oct 29, 2018, 2:14:57 PM10/29/18
to CAS Community
Hi Jerome,

Thanks a lot. I was able to retrieve the attributes in JAVA as given below. We have CAS client which is developed in Python. How do I get that CasProfile in Python?. Do pac4j support Python?. When we try Django-cas-ng it is giving AnonymousUser.

public CasProfile validateServiceTicket(final String serviceURL, final TokenCredentials ticket) {
        try {
            final Assertion assertion = getCasRestAuthenticator().getTicketValidator()
                    .validate(ticket.getToken(), serviceURL);
            final AttributePrincipal principal = assertion.getPrincipal();
            final CasProfile casProfile = new CasProfile();
            casProfile.setId(principal.getName());
            casProfile.addAttributes(principal.getAttributes());
            return casProfile;
        } catch (final TicketValidationException e) {
            throw new TechnicalException(e);
        }
    }

    public CasRestAuthenticator getCasRestAuthenticator() {
        Authenticator authenticator = getAuthenticator();
        if (authenticator instanceof LocalCachingAuthenticator) {
            authenticator = ((LocalCachingAuthenticator) authenticator).getDelegate();
        }
        if (authenticator instanceof CasRestAuthenticator) {
            return (CasRestAuthenticator) authenticator;
        }
        throw new TechnicalException("authenticator must be a CasRestAuthenticator (or via a LocalCachingAuthenticator)");
    }



On Friday, 16 March 2018 11:34:51 UTC-4, leleuj wrote:
On Thu, Mar 15, 2018 at 3:31 AM, uvaraj s <suv...@gmail.com> wrote:
Hi,

We are using CAS 4.1.2 and pac4j 1.7 version. We are making SAML2Client call to shibboleth. These question might look like very basic ones. But the answer to these will help us a lot.

1.On the logs, I am able to see the attribute details getting printed. But wanted to know how we can able to retrieve user profile details in the code?.
2.How does client application who uses this CAS server will be able to get these attribute details?

Thanks a lot in Advance.

--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.

Jérôme LELEU

unread,
Oct 30, 2018, 12:28:23 PM10/30/18
to cas-...@apereo.org
Hi,

By nature, pac4j is written in Java language. In any case, data are passed via the CAS assertion.
For simple types, things should be straightforward. For more complex types, you many need some manual/custom adjustments.
Thanks.
Best regards,
Jérôme


Reply all
Reply to author
Forward
0 new messages