MCPcopy Create free account
hub / github.com/apache/trafficserver / AuthProxyGlobalHook

Function AuthProxyGlobalHook

plugins/authproxy/authproxy.cc:687–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687static int
688AuthProxyGlobalHook(TSCont /* cont ATS_UNUSED */, TSEvent event, void *edata)
689{
690 TSHttpTxn txn = static_cast<TSHttpTxn>(edata);
691
692 AuthLogDebug("handling event=%d edata=%p", (int)event, edata);
693
694 switch (event) {
695 case TS_EVENT_HTTP_POST_REMAP:
696 // Ignore internal requests since we generated them.
697 if (TSHttpTxnIsInternal(txn)) {
698 // All our internal requests *must* hit the origin since it is the
699 // agent that needs to make the authorization decision. We can't
700 // allow that to be cached. Note that this only affects the remap
701 // rule that this plugin is instantiated for, *unless* you are using
702 // it as a global plugin (not highly recommended). Also remember that
703 // the HEAD auth request might trip a different remap rule, particularly
704 // if you do not have pristine host-headers enabled.
705 if (!CacheInternalRequests(txn))
706 TSHttpTxnConfigIntSet(txn, TS_CONFIG_HTTP_CACHE_HTTP, 0);
707 AuthLogDebug("re-enabling internal transaction");
708 TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
709 return TS_EVENT_NONE;
710 }
711 // Hook this request if we are in global authorization mode or if a
712 // remap rule tagged it.
713 if (AuthGlobalOptions != nullptr || AuthRequestIsTagged(txn)) {
714 AuthRequestContext *auth = AuthRequestContext::allocate();
715 auth->state = StateTableInit;
716 auth->txn = txn;
717 return AuthRequestContext::dispatch(auth->cont, event, edata);
718 }
719 // fallthrough
720
721 default:
722 return TS_EVENT_NONE;
723 }
724}
725
726static AuthOptions *
727AuthParseOptions(int argc, const char **argv)

Callers

nothing calls this directly

Calls 6

TSHttpTxnIsInternalFunction · 0.85
CacheInternalRequestsFunction · 0.85
TSHttpTxnConfigIntSetFunction · 0.85
TSHttpTxnReenableFunction · 0.85
AuthRequestIsTaggedFunction · 0.85
dispatchFunction · 0.85

Tested by

no test coverage detected