Giter Site home page Giter Site logo

insa-auth's Introduction

A JWT-based authentification system for unofficial INSA Rouen's services.

Put an entire static website behind auth using nginx

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name {{ insa_scan_domains | join(' ') }};

    ssl_certificate /etc/letsencrypt/live/{{ webserver_name }}/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/{{ webserver_name }}/privkey.pem;

    root /data/insa_scan/site;
    auth_request /auth;
    
    location = /auth {
        internal;
        proxy_pass https://auth.insa.lol/verify;
        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header X-Original-URI $request_uri;
    }

    error_page 401 = @error401;
    location @error401 {
        return 302 https://auth.insa.lol/login?next=$scheme://$http_host$request_uri;
    }
}

Put a specific scope behind auth using nginx

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name {{ insa_scan_domains | join(' ') }};

    ssl_certificate /etc/letsencrypt/live/{{ webserver_name }}/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/{{ webserver_name }}/privkey.pem;

    root /data/insa_scan/site;
    
    location /private/ {
        auth_request /auth;
        auth_request_set $insa_auth_email $upstream_http_x_insa_auth_email;
        auth_request_set $insa_auth_uid $upstream_http_x_insa_auth_uid;
        auth_request_set $insa_auth_uid_number $upstream_http_x_insa_auth_uid_number;
        auth_request_set $insa_auth_groups $upstream_http_x_insa_auth_groups;
        auth_request_set $insa_auth_given_name $upstream_http_x_insa_auth_given_name;
        auth_request_set $insa_auth_family_name $upstream_http_x_insa_auth_family_name;
        proxy_set_header X-Insa-Auth-Email $insa_auth_email;
        proxy_set_header X-Insa-Auth-Uid $insa_auth_uid;
        proxy_set_header X-Insa-Auth-Uid-Number $insa_auth_uid_number;
        proxy_set_header X-Insa-Auth-Groups $insa_auth_groups;
        proxy_set_header X-Insa-Auth-Given-Name $insa_auth_given_name;
        proxy_set_header X-Insa-Auth-Family-Name $insa_auth_family_name;
    }

    location = /auth {
        internal;
        proxy_pass https://auth.insa.lol/verify;
        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header X-Original-URI $request_uri;
    }

    error_page 401 = @error401;
    location @error401 {
        return 302 https://auth.insa.lol/login?next=$scheme://$http_host$request_uri;
    }
}

insa-auth's People

Contributors

mubelotix avatar

Watchers

 avatar

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.