{
  "slug": "Ory-Oathkeeper-Hello-world-8069a1e48d3e",
  "title": "Ory Oathkeeper Hello world",
  "subtitle": "delegate authentication to the API Gateway level using Kratos and Oathkeeper",
  "excerpt": "delegate authentication to the API Gateway level using Kratos and Oathkeeper",
  "date": "2023-02-06",
  "tags": [
    "My Experience",
    "API",
    "Security"
  ],
  "readingTime": "1 min",
  "url": "https://medium.com/@mobinshaterian/ory-oathkeeper-hello-world-8069a1e48d3e",
  "hero": "https://cdn-images-1.medium.com/max/800/1*jcoz1TlOq2M86hexIH2xAw.png",
  "content": [
    {
      "type": "heading",
      "level": 2,
      "text": "Ory Oathkeeper Hello world"
    },
    {
      "type": "embed",
      "provider": "youtube",
      "url": "https://www.youtube.com/embed/ivK6igAWlBo?start=13&feature=oembed&start=13"
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*jcoz1TlOq2M86hexIH2xAw.png",
      "alt": "Ory Oathkeeper Hello world",
      "caption": "",
      "width": 902,
      "height": 542
    },
    {
      "type": "heading",
      "level": 2,
      "text": "delegate authentication to the API Gateway level using Kratos and Oathkeeper"
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*ODNeBOPJO0_Q8EzsaAV0xA.png",
      "alt": "Ory Oathkeeper Hello world",
      "caption": "",
      "width": 1520,
      "height": 787
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*iCT1adL4yS5j54ojE6uqkQ.png",
      "alt": "Ory Oathkeeper Hello world",
      "caption": "",
      "width": 1189,
      "height": 568
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*d2eFUx6ig4BEaUR-fge6ag.png",
      "alt": "Architecture of Authentication",
      "caption": "Architecture of Authentication",
      "width": 957,
      "height": 664
    },
    {
      "type": "embed",
      "provider": "youtube",
      "url": "https://www.youtube.com/embed/JhlIZ3aChXc?feature=oembed"
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*OtDzP5N_lqgknmcM1ydjzA.png",
      "alt": "Ory Oathkeeper Hello world",
      "caption": "",
      "width": 1044,
      "height": 690
    },
    {
      "type": "heading",
      "level": 2,
      "text": "ory hydra plus oathkeeper"
    },
    {
      "type": "code",
      "lang": "text",
      "code": "Run the Oathkeeper server mounting the configuration and rules file.    client-credentials: enable\nonly the oauth2_client_credentials authenticator        It seems the default\noauth2_client_credentials scope_strategy is exact    token-introspection: enable only the\noauth2_introspection authenticatorBoth authenticators are enabled in the main config but\nI'm experimenting using them one at a time enabling the desired rule$ docker run --rm \\  --network hydra-oathkeeper \\  --name oathkeeper-server \\  -p 4455:4455 \\  -p 4456:4456 \\  -v $(pwd)/oathkeeper-config.yaml:/oathkeeper-config.yaml \\  -v $(pwd)/AUTHENTICATOR_PER_RULE_FOLDER/rules.json:/rules.json \\  oryd/oathkeeper:v0.38 \\  --config /oathkeeper-config.yaml \\  serve"
    },
    {
      "type": "paragraph",
      "html": "Zero trust Network architecture"
    },
    {
      "type": "embed",
      "provider": "youtube",
      "url": "https://www.youtube.com/embed/EQliBFL3IPs?feature=oembed"
    },
    {
      "type": "code",
      "lang": "json",
      "code": "{\n  \"authenticators\": [\n    {\n      \"handler\": \"oauth2_client_credentials\",\n      \"config\": {\n        \"required_scope\": [\n          \"dialogs\"\n        ]\n      }\n    }\n  ]\n}"
    },
    {
      "type": "code",
      "lang": "text",
      "code": "Oathkeeper  client-credentials"
    }
  ]
}