Accessing Shibboleth properties from javascript
Max Spicer
max.spicer at york.ac.uk
Fri Nov 17 14:13:27 UTC 2023
Thanks, Scott.
As the script already needs the attribute resolver service passed in via
the custom object, I've gone for something along these lines (using
entityID purely as an example property):
<util:map id="customObjectMap">
<entry key="entityID" value="%{idp.entityID:borked}" />
<entry key="attributeResolverService" value-ref=
"shibboleth.AttributeResolverService" />
</util:map>
<bean id="checkSecondFactor" parent="shibboleth.ContextFunctions.Scripted"
factory-method="resourceScript"
c:resource="%{idp.home}/conf/authn/checkSecondFactor.js"
c:outputType="java.lang.String"
p:customObject-ref="customObjectMap" />
My spring fu is limited but that seems to do the trick. The script then has
access to custom.entityID and custom.attributeResolverService.
Cheers,
Max
On Fri, 17 Nov 2023 at 13:01, Cantor, Scott <cantor.2 at osu.edu> wrote:
> > Are the properties defined in idp.properties etc accessible from such
> > scripts?
>
> They're part of the Spring environment, but it's a bit tricky to get at it
> (except from Java, where it's trivial), you need to get at the
> ApplicationContext interface to do it programatically.
>
> What I would probably do were it me, to avoid extra code, is to inject
> specific properties into custom objects and then inject the custom objects
> into the script in the usual way.
>
> Populate a map with anything you need basically.
>
> <util:map id="...">
> <entry key="foo" value="%{name:default}" />
> </util:map>
>
> -- Scott
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20231117/0c39a7d4/attachment.htm>
More information about the users
mailing list