Bind a delegating security handler. Any request will be routed through this handler and can be allowed or denied by this handler. If no handler
is bound, requests are forwarded to the internal handler collection.
439875
public static LinkedBindingBuilder<HandlerWrapper> bindSecurityHandler(final Binder binder)
    {
        return binder.bind(HandlerWrapper.class).annotatedWith(SECURITY_NAMED);
    }
824988
public void bindInstanceToSecurityGroup(BindSecurityGroupRequest request) {
        checkNotNull(request, "request should not be null.");
        checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
        checkStringNotEmpty(request.getSecurityGroupId(), "request securityGroupId should not be empty.");
        InternalRequest internalRequest = this.createRequest(
                request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
        internalRequest.addParameter(InstanceAction.bind.name(), null);
        fillPayload(internalRequest, request);
        this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
172812
public synchronized void setHandler(Handler handler) {
        String handlerId = CollectorManagerUtils.getHandlerId(handler);
        HandlerManager hdlrMgr;
        if (!handlerMgrs.containsKey(handlerId)) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Adding handler to the list", handler.getClass());
            }
            hdlrMgr = new HandlerManager(handler);
            handlerMgrs.put(hdlrMgr.getHandlerId(), hdlrMgr);
            hdlrMgr.getHandler().init(this);
        }
    }
1254452
private static void registerMiddlewareHandler(Object handler) {
		if(handler instanceof MiddlewareHandler) {
			// register the middleware handler if it is enabled.
			if(((MiddlewareHandler) handler).isEnabled()) {
				((MiddlewareHandler) handler).register();
			}
		}
	}
51528
def get_handler(self, *args, **options):
        
        handler = super(Command, self).get_handler(*args, **options)
        insecure_serving = options.get('insecure_serving', False)
        if self.should_use_static_handler(options):
            return StaticFilesHandler(handler)
        return handler
243539
def _generate_request_handler_proxy(handler_class, handler_args, name):
    """"""

    @scope.inject
    def request_handler_wrapper(app, handler, **kwargs):
        handler = handler_class(app, handler.request, **handler_args)
        handler._execute([], **kwargs)
    request_handler_wrapper.__name__ = name
    request_handler_wrapper.handler_class = handler_class
    request_handler_wrapper.handler_args = handler_args

    return request_handler_wrapper
813275
public void bind(ServerSocketBar ss)
    throws IOException
  {
    Objects.requireNonNull(ss);

    _isBind.set(true);

    if (_protocol == null)
      throw new IllegalStateException(L.l("'{0}' must have a configured protocol before starting.", this));

    if (_throttle == null)
      _throttle = new ThrottleSocket();

    _serverSocket = ss;

    String scheme = _protocol.name();

    if (_address != null)
      log.info(scheme + " listening to " + _address + ":" + _port);
    else
      log.info(scheme + " listening to *:" + _port);

    if (_sslFactory != null) {
      try {
        _serverSocket = _sslFactory.bind(_serverSocket);
      } catch (RuntimeException e) {
        throw e;
      } catch (IOException e) {
        throw e;
      } catch (Exception e) {
        throw new IOException(e);
      }
    }
  }
714744
function _bind (events, selector, callback, remove) {
  // fail silently if you pass null or undefined as an alement
  // in the Delegator constructor
  if (!this.element) {
    return;
  }

  if (!(events instanceof Array)) {
    events = [events];
  }

  if (!callback && typeof (selector) === 'function') {
    callback = selector;
    selector = '_root';
  }

  if (selector instanceof window.Element) {
    let id;
    if (selector.hasAttribute('bind-event-id')) {
      id = selector.getAttribute('bind-event-id');
    } else {
      id = nextEventId();
      selector.setAttribute('bind-event-id', id);
    }
    selector = `[bind-event-id="${id}"]`;
  }

  let id = this.id;
  let i;

  function _getGlobalCallback (type) {
    return function (e) {
      _handleEvent(id, e, type);
    };
  }

  for (i = 0; i < events.length; i++) {
    _aliases(events[i]).forEach(alias => {
      if (remove) {
        _removeHandler(this, alias, selector, callback);
        return;
      }

      if (!_handlers[id] || !_handlers[id][alias]) {
        Delegator.addEvent(this, alias, _getGlobalCallback(alias));
      }

      _addHandler(this, alias, selector, callback);
    });
  }

  return this;
}
220071
@Override
	public void addSecurityConstraintMappings(
			final SecurityConstraintMappingModel model) {
		final ServletContextHandler context = server.getOrCreateContext(model);
		final SecurityHandler securityHandler = context.getSecurityHandler();
		if (securityHandler == null) {
			throw new IllegalStateException(
					"Internal error: Cannot find the security handler. Please report.");
		}
		String mappingMethod = model.getMapping();
		String constraintName = model.getConstraintName();
		String url = model.getUrl();
		String dataConstraint = model.getDataConstraint();
		List<String> roles = model.getRoles();
		boolean authentication = model.isAuthentication();

		ConstraintMapping newConstraintMapping = new ConstraintMapping();
		newConstraintMapping.setMethod(mappingMethod);
		newConstraintMapping.setPathSpec(url);
		Constraint constraint = new Constraint();
		constraint.setAuthenticate(authentication);
		constraint.setName(constraintName);
		constraint.setRoles(roles.toArray(new String[roles.size()]));

		if (dataConstraint == null || "NONE".equals(dataConstraint)) {
			constraint.setDataConstraint(Constraint.DC_NONE);
		} else if ("INTEGRAL".equals(dataConstraint)) {
			constraint.setDataConstraint(Constraint.DC_INTEGRAL);
		} else if ("CONFIDENTIAL".equals(dataConstraint)) {
			constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
		} else {
			LOG.warn("Unknown user-data-constraint:" + dataConstraint);
			constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
		}

		newConstraintMapping.setConstraint(constraint);

		((ConstraintSecurityHandler) securityHandler)
				.addConstraintMapping(newConstraintMapping);
	}
576483
function requestHandler (method) {
  return function (req, res, next) {
    method.call(this, req, responseHandler(res, next));
  }.bind(this);
}
606670
public boolean removeHandler(PacketHandler handler) {
        synchronized (this.handlers) {
            boolean removed = this.handlers.remove(handler);
            if (removed) {
                this.count.decrementAndGet();
            }
            return removed;
        }
    }
549636
def securityHandler(self, value):
        
        if isinstance(value, abstract.BaseSecurityHandler):
            if isinstance(value, security.AGOLTokenSecurityHandler):
                self._securityHandler = value
                self._token = value.token
                self._username = value.username
                self._password = value._password
                self._token_url = value.token_url
            elif isinstance(value, security.OAuthSecurityHandler):
                self._token = value.token
                self._securityHandler = value
            else:
                pass
1006638
public boolean addHandler(PacketHandler handler) {
        synchronized (this.handlers){
            if (!handlers.contains(handler)) {
                handlers.add(handler);
                this.count.incrementAndGet();
                Collections.sort(this.handlers, REVERSE_COMPARATOR);
                return true;
            }
            return false;
        }
    }
1287520
def set_handler(self, handler):
        
        if self.handler is not None:
            raise Exception('Attempted to overwrite BaseSession handler')

        self.handler = handler
        self.transport_name = self.handler.name

        if self.conn_info is None:
            self.conn_info = handler.get_conn_info()
            self.stats.sessionOpened(self.transport_name)

        return True
739809
private boolean canDelegate(RequestDelegationService delegate, HttpServletRequest request) {
        try {
            return delegate.canDelegate(request);
        } catch (Exception e) {
            log.log(Level.SEVERE,
                String.format("The delegation service can't check the delegability of the request: %s", e.getCause()),
                e.getCause());
            return false;
        }
    }
198175
def unhandle(self, handler):
        
        with self._hlock:
            try:
                self._handler_list.remove(handler)
            except ValueError:
                raise ValueError("Handler is not handling this event, so cannot unhandle it.")
        return self
973423
def _processHandler(self, securityHandler, param_dict):
        """"""
        cj = None
        handler = None
        if securityHandler is None:
            cj = cookiejar.CookieJar()
        elif securityHandler.method.lower() == "token":
            param_dict['token'] = securityHandler.token
            if hasattr(securityHandler, 'cookiejar'):
                cj = securityHandler.cookiejar
            if hasattr(securityHandler, 'handler'):
                handler = securityHandler.handler
        elif securityHandler.method.lower() == "handler":
            handler = securityHandler.handler
            cj = securityHandler.cookiejar
        return param_dict, handler, cj