private boolean isSecuredByPolicy ( Server server ) { boolean isSecured = false ; EndpointInfo ei = server . getEndpoint ( ) . getEndpointInfo ( ) ; PolicyEngine pe = bus . getExtension ( PolicyEngine . class ) ; if ( null == pe ) { LOG . finest ( "No Policy engine found" ) ; return isSecured ; } Destination destination = server . getDestination ( ) ; EndpointPolicy ep = pe . getServerEndpointPolicy ( ei , destination , null ) ; Collection < Assertion > assertions = ep . getChosenAlternative ( ) ; for ( Assertion a : assertions ) { if ( a instanceof TransportBinding ) { TransportBinding tb = ( TransportBinding ) a ; TransportToken tt = tb . getTransportToken ( ) ; AbstractToken t = tt . getToken ( ) ; if ( t instanceof HttpsToken ) { isSecured = true ; break ; } } } Policy policy = ep . getPolicy ( ) ; List < PolicyComponent > pcList = policy . getPolicyComponents ( ) ; for ( PolicyComponent a : pcList ) { if ( a instanceof TransportBinding ) { TransportBinding tb = ( TransportBinding ) a ; TransportToken tt = tb . getTransportToken ( ) ; AbstractToken t = tt . getToken ( ) ; if ( t instanceof HttpsToken ) { isSecured = true ; break ; } } } return isSecured ; }
Is the transport secured by a policy