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)");