GithubHelp home page GithubHelp logo

frankban / basic-auth-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from canonical/basic-auth-service

0.0 1.0 0.0 164 KB

HTTP basic-authorization backend service

Makefile 1.69% Python 97.48% Mako 0.39% Shell 0.44%

basic-auth-service's Introduction

HTTP Basic authorization backend service

This service provides a REST API to manage basic-authorization credentials, and an endpoint for validating credentials provided in a request.

REST API

The REST API for managing credentials is availabile at the /api endpoint.

See the API docs for details on API calls.

API credentials

The REST API requires basic-authorization for access.

Credentials for API access can be managed with the manage-credentials script. This allows adding, removing and listing users. As an example:

$ ./manage-credentials add myuser --description 'a user'
+----------+------------+-------------+
| Username | Password   | Description |
+----------+------------+-------------+
| myuser   | uXaQtXJV6q | a user      |
+----------+------------+-------------+

$ ./manage-credentials list
+----------+-------------+
| Username | Description |
+----------+-------------+
| myuser   | a user      |
| youruser |             |
+----------+-------------+

$ ./manage-credentials remove myuser

Credentials validation

The validation endpoint is presented at /auth-check and returns an empty response with the following HTTP codes:

  • 200 for valid credentials
  • 401 for invalid credentials

This endpoint can be used to integrate the application with web servers; the following snippet shows an example for the Nginx web server:

upstream auth_backend {
    server localhost:8080;
}

server {

    # ... other server config

    # this location is protected by basic-auth 
    location /secret {
        auth_request /auth;
    }

    location = /auth {
        proxy_pass http://auth_backend/auth-check/;
    }

basic-auth-service's People

Contributors

albertodonato avatar frankban 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.