Git Product home page Git Product logo

ingress-nginx-openidc's Introduction

ingress-nginx-openidc

This is a demonstration of ingress-nginx's plugin system and its extensibility in general. Vanilla ingress-nginx does not have a support for OpenID Connect. However we can extend it and add OpenID Connect support using https://github.com/zmartzone/lua-resty-openidc.

We achieve this by creating an ingress-nginx plugin called openidc and installing it to /etc/nginx/lua/plugins/ directory in the image.

In order to build the image use following command:

docker build -t ingress-nginx-openidc rootfs/

For further understanding of the plugin you can inspect rootfs/etc/nginx/lua/plugins/openidc/main.lua file.

You will see that the plugin requires OPENIDC_CLIENT_ID and OPENIDC_CLIENT_SECRET environment variables to be set. You can store these variables in a K8s secret and then configure that in the deployment manifest so that the environment variables are available within ingress-nginx containers.

Finally we need to make changes to /etc/nginx/template/nginx.tmpl and configure the openidc plugin:

plugins.init({ "openidc" })

https://github.com/zmartzone/lua-resty-openidc also requires us to define following Nginx directives:

lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
lua_ssl_verify_depth 5;

# cache for discovery metadata documents
lua_shared_dict discovery 1m;
# cache for JWKs
lua_shared_dict jwks 1m;

This has last been tested with ingress-nginx 0.26.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.