How to inject a ProfileRequestContext into a Predicate ?
Cantor, Scott
cantor.2 at osu.edu
Mon Oct 24 15:30:27 EDT 2016
> Is it possible to inject a ProfileRequestContext into a Predicate ? I’m not
> seeing it.
>
> For IDP-970, an IsAttributeRequiredPredicate which operates on an
> IdPAttribute (i.e. public class IsAttributeRequiredPredicate implements
> Predicate<IdPAttribute>) seems straightforward, but it would need access to
> the PRC.
Not generically. The back door I've been using is Brent + Marvin. Brent made it possible to statelessly inject HttpServletRequest and Marvin added the listener that gets you the PRC from the attribute.
From AbstractProfileConfiguration:
@Nullable protected ProfileRequestContext getProfileRequestContext() {
if (servletRequest != null) {
final Object object = servletRequest.getAttribute(ProfileRequestContext.BINDING_KEY);
if (object instanceof ProfileRequestContext) {
return (ProfileRequestContext) object;
}
log.warn("ProfileConfiguration {}: No ProfileRequestContext in request", getId());
} else {
log.warn("ProfileConfiguration {}: ServletRequest was null", getId());
}
return null;
}
-- Scott
More information about the dev
mailing list