missing URL-encoding in audit log
Andrew Morgan
morgan at orst.edu
Tue Jul 25 17:43:10 EDT 2017
On Mon, 24 Jul 2017, Cantor, Scott wrote:
> On 7/24/17, 7:26 PM, "users on behalf of Andrew Morgan"
> <users-bounces at shibboleth.net on behalf of morgan at orst.edu> wrote:
>
>> I don't see docs on using a script to produce the value on
>> https://wiki.shibboleth.net/confluence/display/IDP30/AuditLoggingConfiguration.
>
> I don't have any examples that I know of. You have to plug in code into
> one of, or several of, the placeholder field maps in audit.xml to
> override the field that's being populated with the unencoded name. You'd
> have to look at audit-system.xml to see what this all looks like. The
> beans are Function<ProfileRequestContext,String>, and it's possible to
> do it with scripts using the shibboleth.ContextFunctions.Scripted bean.
>
> If you provide a field map entry with a key of
> net.shibboleth.idp.cas.protocol.CASAuditFields.SERVICE_URL (which is
> just "SP"), that definition of the the field will overwrite the system's
> definition, so it allows you to replace the field with your own version.
After playing around for a bit, I settled on this:
<bean id="shibboleth.CASValidationAuditExtractors" parent="shibboleth.DefaultCASValidationAuditExtractors" lazy-init="true">
<property name="sourceMap">
<map merge="true">
<entry>
<key>
<util:constant static-field="net.shibboleth.idp.cas.protocol.CASAuditFields.SERVICE_URL"/>
</key>
<bean parent="shibboleth.ContextFunctions.Scripted" factory-method="inlineScript">
<constructor-arg>
<value>
<![CDATA[
var serviceLookupFunctionClass = Java.type("net.shibboleth.idp.cas.audit.impl.ServiceLookupFunction");
var serviceLookupFunction = new serviceLookupFunctionClass();
var service = serviceLookupFunction.apply(input);
if (service != null) {
var serviceNew = service.replace(/\|/g, '%7C');
}
else {
var serviceNew = null;
}
serviceNew;
]]>
</value>
</constructor-arg>
</bean>
</entry>
</map>
</property>
</bean>
This is working correctly in my DEV instance, replacing | with %7C.
Did I do anything wrong? :)
Thanks,
Andy
More information about the users
mailing list