question: private HttpHandler secureHandler ( final HttpHandler toWrap , SecurityRealm securityRealm ) { HttpHandler handler = toWrap ; handler = new AuthenticationCallHandler ( handler ) ; handler = new AuthenticationConstraintHandler ( handler ) ; RealmIdentityManager idm = new RealmIdentityManager ( securityRealm ) ; Set < AuthMechanism > mechanisms = securityRealm . getSupportedAuthenticationMechanisms ( ) ; List < AuthenticationMechanism > undertowMechanisms = new ArrayList < AuthenticationMechanism > ( mechanisms . size ( ) ) ; undertowMechanisms . add ( wrap ( new CachedAuthenticatedSessionMechanism ( ) , null ) ) ; for ( AuthMechanism current : mechanisms ) { switch ( current ) { case DIGEST : List < DigestAlgorithm > digestAlgorithms = Collections . singletonList ( DigestAlgorithm . MD5 ) ; List < DigestQop > digestQops = Collections . singletonList ( DigestQop . AUTH ) ; undertowMechanisms . add ( wrap ( new DigestAuthenticationMechanism ( digestAlgorithms , digestQops , securityRealm . getName ( ) , "Monitor" , new SimpleNonceManager ( ) ) , current ) ) ; break ; case PLAIN : undertowMechanisms . add ( wrap ( new BasicAuthenticationMechanism ( securityRealm . getName ( ) ) , current ) ) ; break ; case LOCAL : break ; } } handler = new AuthenticationMechanismsHandler ( handler , undertowMechanisms ) ; handler = new SecurityInitialHandler ( AuthenticationMode . PRO_ACTIVE , idm , handler ) ; handler = new PredicateHandler ( null , handler , toWrap ) ; return handler ; }
target:  Wraps the target handler and makes it inheritSecurity. Includes a predicate for relevant web contexts.