ingress-nginx-helm/examples/customization/external-auth-headers/index.html

99 lines
33 KiB
HTML
Raw Permalink Normal View History

2024-09-15 15:04:08 +00:00
<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link href=https://kubernetes.github.io/ingress-nginx/examples/customization/external-auth-headers/ rel=canonical><link href=../custom-headers/ rel=prev><link href=../ssl-dh-param/ rel=next><link rel=icon href=../../../assets/images/favicon.png><meta name=generator content="mkdocs-1.5.3, mkdocs-material-9.4.5"><title>External authentication - Ingress-Nginx Controller</title><link rel=stylesheet href=../../../assets/stylesheets/main.6a10b989.min.css><link rel=stylesheet href=../../../assets/stylesheets/palette.356b1318.min.css><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback"><style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style><link rel=stylesheet href=../../../extra.css><script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script></head> <body dir=ltr data-md-color-scheme=default data-md-color-primary=teal data-md-color-accent=green> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#external-authentication-authentication-service-response-headers-propagation class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class="md-header md-header--shadow md-header--lifted" data-md-component=header> <nav class="md-header__inner md-grid" aria-label=Header> <a href=../../.. title="Ingress-Nginx Controller" class="md-header__button md-logo" aria-label="Ingress-Nginx Controller" data-md-component=logo> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg> </a> <label class="md-header__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg> </label> <div class=md-header__title data-md-component=header-title> <div class=md-header__ellipsis> <div class=md-header__topic> <span class=md-ellipsis> Ingress-Nginx Controller </span> </div> <div class=md-header__topic data-md-component=header-topic> <span class=md-ellipsis> External authentication </span> </div> </div> </div> <label class="md-header__button md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg> </label> <div class=md-search data-md-component=search role=dialog> <label class=md-search__overlay for=__search></label> <div class=md-search__inner role=search> <form class=md-search__form name=search> <input type=text class=md-search__input name=query aria-label=Search placeholder=Search autocapitalize=off autocorrect=off autocomplete=off spellcheck=false data-md-component=search-query required> <label class="md-search__icon md-icon" for=__search> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5
2021-01-11 15:59:14 +00:00
<span class=go>deployment &quot;demo-auth-service&quot; created</span>
<span class=go>service &quot;demo-auth-service&quot; created</span>
<span class=go>ingress &quot;demo-auth-service&quot; created</span>
<span class=go>deployment &quot;demo-echo-service&quot; created</span>
<span class=go>service &quot;demo-echo-service&quot; created</span>
<span class=go>ingress &quot;public-demo-echo-service&quot; created</span>
<span class=go>ingress &quot;secure-demo-echo-service&quot; created</span>
2023-10-12 19:31:18 +00:00
<span class=gp>$ </span>kubectl<span class=w> </span>get<span class=w> </span>po
2021-01-11 15:59:14 +00:00
<span class=go>NAME READY STATUS RESTARTS AGE</span>
<span class=go>demo-auth-service-2769076528-7g9mh 1/1 Running 0 30s</span>
<span class=go>demo-echo-service-3636052215-3vw8c 1/1 Running 0 29s</span>
<span class=go>kubectl get ing</span>
<span class=go>NAME HOSTS ADDRESS PORTS AGE</span>
<span class=go>public-demo-echo-service public-demo-echo-service.kube.local 80 1m</span>
<span class=go>secure-demo-echo-service secure-demo-echo-service.kube.local 80 1m</span>
2023-10-12 19:31:18 +00:00
</code></pre></div> <h2 id=test-1-public-service-with-no-auth-header>Test 1: public service with no auth header<a class=headerlink href=#test-1-public-service-with-no-auth-header title="Permanent link"></a></h2> <div class=highlight><pre><span></span><code><span class=gp>$ </span>curl<span class=w> </span>-H<span class=w> </span><span class=s1>&#39;Host: public-demo-echo-service.kube.local&#39;</span><span class=w> </span>-v<span class=w> </span><span class=m>192</span>.168.99.100
2021-01-11 15:59:14 +00:00
<span class=go>* Rebuilt URL to: 192.168.99.100/</span>
<span class=go>* Trying 192.168.99.100...</span>
<span class=go>* Connected to 192.168.99.100 (192.168.99.100) port 80 (#0)</span>
2023-10-12 19:31:18 +00:00
<span class=go>&gt; GET / HTTP/1.1</span>
<span class=go>&gt; Host: public-demo-echo-service.kube.local</span>
<span class=go>&gt; User-Agent: curl/7.43.0</span>
<span class=go>&gt; Accept: */*</span>
<span class=go>&gt;</span>
2021-01-11 15:59:14 +00:00
<span class=go>&lt; HTTP/1.1 200 OK</span>
<span class=go>&lt; Server: nginx/1.11.10</span>
<span class=go>&lt; Date: Mon, 13 Mar 2017 20:19:21 GMT</span>
<span class=go>&lt; Content-Type: text/plain; charset=utf-8</span>
<span class=go>&lt; Content-Length: 20</span>
<span class=go>&lt; Connection: keep-alive</span>
<span class=go>&lt;</span>
<span class=go>* Connection #0 to host 192.168.99.100 left intact</span>
<span class=go>UserID: , UserRole:</span>
2023-10-12 19:31:18 +00:00
</code></pre></div> <h2 id=test-2-secure-service-with-no-auth-header>Test 2: secure service with no auth header<a class=headerlink href=#test-2-secure-service-with-no-auth-header title="Permanent link"></a></h2> <div class=highlight><pre><span></span><code><span class=gp>$ </span>curl<span class=w> </span>-H<span class=w> </span><span class=s1>&#39;Host: secure-demo-echo-service.kube.local&#39;</span><span class=w> </span>-v<span class=w> </span><span class=m>192</span>.168.99.100
2021-01-11 15:59:14 +00:00
<span class=go>* Rebuilt URL to: 192.168.99.100/</span>
<span class=go>* Trying 192.168.99.100...</span>
<span class=go>* Connected to 192.168.99.100 (192.168.99.100) port 80 (#0)</span>
2023-10-12 19:31:18 +00:00
<span class=go>&gt; GET / HTTP/1.1</span>
<span class=go>&gt; Host: secure-demo-echo-service.kube.local</span>
<span class=go>&gt; User-Agent: curl/7.43.0</span>
<span class=go>&gt; Accept: */*</span>
<span class=go>&gt;</span>
2021-01-11 15:59:14 +00:00
<span class=go>&lt; HTTP/1.1 403 Forbidden</span>
<span class=go>&lt; Server: nginx/1.11.10</span>
<span class=go>&lt; Date: Mon, 13 Mar 2017 20:18:48 GMT</span>
<span class=go>&lt; Content-Type: text/html</span>
<span class=go>&lt; Content-Length: 170</span>
<span class=go>&lt; Connection: keep-alive</span>
<span class=go>&lt;</span>
<span class=go>&lt;html&gt;</span>
<span class=go>&lt;head&gt;&lt;title&gt;403 Forbidden&lt;/title&gt;&lt;/head&gt;</span>
<span class=go>&lt;body bgcolor=&quot;white&quot;&gt;</span>
<span class=go>&lt;center&gt;&lt;h1&gt;403 Forbidden&lt;/h1&gt;&lt;/center&gt;</span>
<span class=go>&lt;hr&gt;&lt;center&gt;nginx/1.11.10&lt;/center&gt;</span>
<span class=go>&lt;/body&gt;</span>
<span class=go>&lt;/html&gt;</span>
<span class=go>* Connection #0 to host 192.168.99.100 left intact</span>
2023-10-12 19:31:18 +00:00
</code></pre></div> <h2 id=test-3-public-service-with-valid-auth-header>Test 3: public service with valid auth header<a class=headerlink href=#test-3-public-service-with-valid-auth-header title="Permanent link"></a></h2> <div class=highlight><pre><span></span><code><span class=gp>$ </span>curl<span class=w> </span>-H<span class=w> </span><span class=s1>&#39;Host: public-demo-echo-service.kube.local&#39;</span><span class=w> </span>-H<span class=w> </span><span class=s1>&#39;User:internal&#39;</span><span class=w> </span>-v<span class=w> </span><span class=m>192</span>.168.99.100
2021-01-11 15:59:14 +00:00
<span class=go>* Rebuilt URL to: 192.168.99.100/</span>
<span class=go>* Trying 192.168.99.100...</span>
<span class=go>* Connected to 192.168.99.100 (192.168.99.100) port 80 (#0)</span>
2023-10-12 19:31:18 +00:00
<span class=go>&gt; GET / HTTP/1.1</span>
<span class=go>&gt; Host: public-demo-echo-service.kube.local</span>
<span class=go>&gt; User-Agent: curl/7.43.0</span>
<span class=go>&gt; Accept: */*</span>
<span class=go>&gt; User:internal</span>
<span class=go>&gt;</span>
2021-01-11 15:59:14 +00:00
<span class=go>&lt; HTTP/1.1 200 OK</span>
<span class=go>&lt; Server: nginx/1.11.10</span>
<span class=go>&lt; Date: Mon, 13 Mar 2017 20:19:59 GMT</span>
<span class=go>&lt; Content-Type: text/plain; charset=utf-8</span>
<span class=go>&lt; Content-Length: 44</span>
<span class=go>&lt; Connection: keep-alive</span>
<span class=go>&lt;</span>
<span class=go>* Connection #0 to host 192.168.99.100 left intact</span>
<span class=go>UserID: 1443635317331776148, UserRole: admin</span>
2023-10-12 19:31:18 +00:00
</code></pre></div> <h2 id=test-4-secure-service-with-valid-auth-header>Test 4: secure service with valid auth header<a class=headerlink href=#test-4-secure-service-with-valid-auth-header title="Permanent link"></a></h2> <div class=highlight><pre><span></span><code><span class=gp>$ </span>curl<span class=w> </span>-H<span class=w> </span><span class=s1>&#39;Host: secure-demo-echo-service.kube.local&#39;</span><span class=w> </span>-H<span class=w> </span><span class=s1>&#39;User:internal&#39;</span><span class=w> </span>-v<span class=w> </span><span class=m>192</span>.168.99.100
2021-01-11 15:59:14 +00:00
<span class=go>* Rebuilt URL to: 192.168.99.100/</span>
<span class=go>* Trying 192.168.99.100...</span>
<span class=go>* Connected to 192.168.99.100 (192.168.99.100) port 80 (#0)</span>
2023-10-12 19:31:18 +00:00
<span class=go>&gt; GET / HTTP/1.1</span>
<span class=go>&gt; Host: secure-demo-echo-service.kube.local</span>
<span class=go>&gt; User-Agent: curl/7.43.0</span>
<span class=go>&gt; Accept: */*</span>
<span class=go>&gt; User:internal</span>
<span class=go>&gt;</span>
2021-01-11 15:59:14 +00:00
<span class=go>&lt; HTTP/1.1 200 OK</span>
<span class=go>&lt; Server: nginx/1.11.10</span>
<span class=go>&lt; Date: Mon, 13 Mar 2017 20:17:23 GMT</span>
<span class=go>&lt; Content-Type: text/plain; charset=utf-8</span>
<span class=go>&lt; Content-Length: 43</span>
<span class=go>&lt; Connection: keep-alive</span>
<span class=go>&lt;</span>
<span class=go>* Connection #0 to host 192.168.99.100 left intact</span>
<span class=go>UserID: 605394647632969758, UserRole: admin</span>
2023-10-12 19:31:18 +00:00
</code></pre></div> </article> </div> </div> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> Made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "../../..", "features": ["navigation.tabs", "navigation.tabs.sticky", "navigation.instant", "navigation.sections"], "search": "../../../assets/javascripts/workers/search.f886a092.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script> <script src=../../../assets/javascripts/bundle.aecac24b.min.js></script> </body> </html>