Headeres for the HTTP Data Connections
Alex Perez
Alex.Perez-Mendez at jisc.ac.uk
Thu Jun 6 04:49:51 EDT 2019
Replying to myself...
Hello,
I'm building a SAML AA entity that instead of storing attributes, uses a REST API to retrieve them from an external server. I'm using the HTTPConnector with partial success. The external server allows for header-based authorization. When disabled (ie. no authorization), it works fine: the request is sent and the response is obtained, parsed and the attributes generated correctly.
The problem is that if authorization is enabled, I need HTTPConnector to include the authorization header. It seems it must be done using headerMapRef but the documentation says it must be a Bean ID, and I'm not sure where this bean must be declared and I've found 0 examples around (there are literarily 2 Google results for "headerMapRef".
So, I finally ended up putting the following into c14n/subject-c14n.xml (I chose this file because it's a file I'm already mapping in my Docker environment).
<util:map id="AuthHeaders">
<entry key="Authorization" value="thisismysecuretoken2"/>
</util:map>
In my attribute-resolver.xml I have the following:
<resolver:DataConnector id="myHTTP" xsi:type="resolver:HTTP"
httpClientRef="shibboleth.NonCachingHttpClient"
headerMapRef="AuthHeaders">
And it works. Do you have any recommendation on where to put the map definition? I bet subject-c14n.xml is not the best place ever, but I tried global.xml without success.
Best,
Alex
--
Alejandro Perez-Mendez
Technical Specialist (AAA), Trust & Identity
M (+34) 619 333 219
Skype alejandro_perez_mendez
jisc.ac.uk
Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.
Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20190606/fa40bb36/attachment.html>
More information about the users
mailing list