"use strict";(self.webpackChunkdocusaurus=self.webpackChunkdocusaurus||[]).push([[9834],{3905:function(e,t,n){n.d(t,{Zo:function(){return s},kt:function(){return f}});var o=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),p=l(n),m=r,f=p["".concat(c,".").concat(m)]||p[m]||d[m]||a;return n?o.createElement(f,i(i({ref:t},s),{},{components:n})):o.createElement(f,i({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u[p]="string"==typeof e?e:r,i[1]=u;for(var l=2;l/oauth2-proxy\ncd oauth2-proxy\ngit branch feature/\ngit push --set-upstream origin feature/\ngo mod download\n")),(0,a.kt)("h1",{id:"testing--debugging"},"Testing / Debugging"),(0,a.kt)("p",null,"For starting oauth2-proxy locally open the debugging tab and create the ",(0,a.kt)("inlineCode",{parentName:"p"},"launch.json")," and select ",(0,a.kt)("inlineCode",{parentName:"p"},"Go: Launch Package"),"."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"Debugging Tab",src:n(8561).Z,width:"351",height:"273"})),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json"},'{\n "version": "0.2.0",\n "configurations": [\n {\n "name": "Launch OAuth2-Proxy with Dex",\n "type": "go",\n "request": "launch",\n "mode": "auto",\n "program": "${workspaceFolder}",\n "args": [\n "--config",\n // The following configuration contains settings for a locally deployed \n // upstream and dex as an idetity provider\n "contrib/local-environment/oauth2-proxy.cfg"\n ]\n },\n {\n "name": "Launch OAuth2-Proxy with Keycloak",\n "type": "go",\n "request": "launch",\n "mode": "auto",\n "program": "${workspaceFolder}",\n "args": [\n "--config",\n // The following configuration contains settings for a locally deployed \n // upstream and keycloak as an idetity provider\n "contrib/local-environment/oauth2-proxy-keycloak.cfg"\n ]\n }\n ]\n}\n')),(0,a.kt)("p",null,"Before you can start your local version of oauth2-proxy, you will have to use the provided docker compose files to start a local upstream service and identity provider. We suggest using ",(0,a.kt)("a",{parentName:"p",href:"https://hub.docker.com/r/kennethreitz/httpbin"},"httpbin")," as your upstream for testing as it allows for request and response introspection of all things HTTP."),(0,a.kt)("p",null,"Open a terminal and switch to the ",(0,a.kt)("inlineCode",{parentName:"p"},"contrib/local-environment")," directory."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Dex as your IdP: ",(0,a.kt)("inlineCode",{parentName:"li"},"docker compose -f docker-compose.yaml up dex etcd httpbin")),(0,a.kt)("li",{parentName:"ul"},"Keycloak as your IdP: ",(0,a.kt)("inlineCode",{parentName:"li"},"docker compose -f docker-compose-keycloak.yaml up keycloak httpbin"))),(0,a.kt)("p",null,"The username for both is ",(0,a.kt)("inlineCode",{parentName:"p"},"admin@example.com")," and password is ",(0,a.kt)("inlineCode",{parentName:"p"},"password"),"."),(0,a.kt)("p",null,"Start oauth2-proxy from the debug tab and open ",(0,a.kt)("a",{parentName:"p",href:"http://oauth2-proxy.localtest.me:4180/"},"http://oauth2-proxy.localtest.me:4180/")," for testing."))}f.isMDXComponent=!0},8561:function(e,t,n){t.Z=n.p+"assets/images/debug-tab-030a951c9fa8eda4e570e8663f1bbc6d.png"}}]);