...
Configuring this is quite simple (note per the WarningInterceptConfiguration topic, you need to enable the relevant Module first). In the example below, a single service is monitored, and a view template must be created in views/intercept/loop-detected.vm to render. The example also applies a warning "duration" of zero, which is a signal that the warning should always appear when the condition is met rather than only at some lower interval. The trigger is set by the threshold
property, which defaults to 20 requests in a minute.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
default-init-method="initialize"
default-destroy-method="destroy">
<!--
The map keys are the names of view templates to render if the condition evaluates to true.
The values are of type Pair<Predicate<ProfileRequestContext>,Duration>. The condition determines whether
the warning is displayed, and the duration is the interval between warnings.
-->
<util:map id="shibboleth.warning.ConditionMap">
<entry key="loop-detected">
<bean parent="shibboleth.Pair">
<constructor-arg index="0">
<bean class="net.shibboleth.idp.profile.logic.LoopDetectionPredicate" p:threshold="20">
<property name="relyingPartyMap">
<map>
<entry key="https://sp.example.org/shibboleth" value="example" />
</map>
</property>
<property name="usernameLookupStrategy">
<bean parent="shibboleth.Functions.Compose"
c:g-ref="shibboleth.PrincipalNameLookup.Subject"
c:f-ref="shibboleth.ChildLookup.SubjectContext" />
</property>
</bean>
</constructor-arg>
<constructor-arg index="1">
<bean class="java.time.Duration" factory-method="parse" c:_0="PT0S" />
</constructor-arg>
</bean>
</entry>
</util:map>
</beans> |