...
This flow can operate in a limited "single condition" mode, or a more flexible functional mode. The functional mode is strongly suggested.
Localtabgroup | |||||
---|---|---|---|---|---|
Localtab live | |||||
active | true | ||||
Expand | |||||
| |||||
Previously, it was common to need to create copies of the flow to accommodate different needs. While this is possible, it can be avoided in essentially all cases by using the support for applying a Function instead of a single condition/predicate. While the condition mode applies a single condition and returns a fixed error Event, the Function mode is more general in that it directly returns a string to use as the follow up event. A bean named shibboleth.context-check.Function in conf/intercept/context-check-intercept-config.xml must be defined by you with the function you want to apply. The bean must be of type Function<ProfileRequestContext,String>. The return value contains the event that the interceptor should signal, either "proceed" to indicate that processing should continue successfully or any other value as a custom Event. For example, returning "ContextCheckDenied" will match the existing behavior of the original condition mode. If you want to support one or more custom events, you'll need to add the event(s) to conf/intercept/intercept-events-flow.xml. The default file includes a commented example for an event called "MyCustomEvent". Then you'll need to add that event in conf/errors.xml if you want it handled with a local error page. As a primitive example, consider a map indexed by relying party name, allowing a condition to be uniquely defined for each applicable relying party separately. Example function using a map of conditions
|
Expand | ||
---|---|---|
| ||
The only configuration involved with this mode is to define the condition you want it to evaluate, and possibly adjust the user interface result in the event of failure. The bean named shibboleth.context-check.Condition in conf/intercept/context-check-intercept-config.xml must be defined by you with the condition you want to apply. The bean must be of type Predicate<ProfileRequestContext>, but beyond that, it can do anything. Note that this is the same type signature as the conditions discussed in the ActivationConditions topic, so the examples there may help you. Non-programmers may be particularly interested in the scripted examples.
The other half of the configuration of this flow is the result. Obviously success simply causes things to proceed in the usual fashion, but failure will produce an event called "ContextCheckDenied". The IdP's built-in ErrorHandlingConfiguration treats that event as a "local error", meaning that processing is halted and an error page displayed. The event is mapped to a default error message using the standard machinery, which you can adjust, but producing the right response for a lot of different (possibly unrelated) scenarios will quickly become hard to manage. You will probably want to define your own events, and to do that, you should use the Function mode described earlier. |
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Reference
...
Beans
Bean ID | Type | Description |
---|---|---|
shibboleth.context-check.Condition | Condition evaluated by the interceptor flow to decide whether to continue | |
shibboleth.context-check.Function | Function evaluated by the interceptor flow to produce the event to signal |