Acquiring principals of a a subject
Martin Leonhartsberger
m.leonhartsberger at cumulo.at
Fri May 19 13:32:21 UTC 2023
Hello,
I have an IDP using SAML flow to multiple upstream IDPs.
I would like to get the issuer information, which upstream authenticated the subject -> resolve into an attribute using a scripted attribute.
Reduced to the core I try this:
subjectContext=profileContext.getSubcontext("net.shibboleth.idp.authn.context.SubjectContext");
subject=subjectContext.getSubjects();
logger.debug("Current Subject: " + subject);
subject.getPrincipals(Java.type("net.shibboleth.idp.authn.principal.ProxyAuthenticationPrincipal").class);
Result – Subject is populated and accessible, I see the information I’m looking for in authorities.
Current Subject: [Subject:
Principal: net.shibboleth.idp.saml.authn.principal.NameIDPrincipal at 56942c79<mailto:net.shibboleth.idp.saml.authn.principal.NameIDPrincipal at 56942c79>
Principal: AuthnContextClassRefPrincipal{authnContextClassRef=urn:oasis:names:tc:SAML:2.0:ac:classes:Password}
Principal: ProxyAuthenticationPrincipal{authorities=[https://federation.testportal.at/idp/shibboleth], proxyCount=null, audiences=[]}
Principal: IdPAttributePrincipal{attribute=IdPAttribute{id=USERID, displayNames={}, displayDescriptions={}, values=[StringAttributeValue{value=123456789}]}}
Now on acquiring the content of the ProxyAuthenticationPrincipal:
subject.getPrincipals(Java.type("net.shibboleth.idp.authn.principal.ProxyAuthenticationPrincipal").class);
or
subject.getPrincipals();
Which fails:
javax.script.ScriptException: TypeError: subject.getPrincipals is not a function
But it should according to documentation:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/security/auth/Subject.html
Anybody having an idea what I’m missing? Are the Subject-Principals not exposed on the way I would like to acquire them?
Best regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20230519/36bc4c1c/attachment.htm>
More information about the users
mailing list