📗
Janus Manual
  • Introduction
  • Installation
    • Docker
  • Quick Start
    • Authenticating
    • Add an endpoint
    • Modify (Update/Delete) an endpoint
    • Add Plugins
    • Authentication
    • Adding your API - File System
  • Clustering/HA
  • Proxy Reference
    • Terminology
    • Overview
    • Routing capabilities
    • Load Balacing
    • Request Host header
      • Using wildcard hostnames
      • The preserve_host property
    • Request URI
      • The strip_path property
      • The append_path property
    • Request HTTP method
    • Routing priorities
    • Conclusion
  • Plugins
    • Basic
    • Organization
    • Body Limit
    • Circuit Breaker
    • Compression
    • CORS
    • OAuth
    • Rate Limit
    • Request Transformer
    • Response Transformer
    • Retry
  • Auth
    • OAuth 2.0
  • Misc
    • Health Checks
    • Monitoring
    • Tracing
  • Known Issues
    • Stale HTTP Keep-Alive
  • Upgrade Notes
    • 2.x to 3.x
    • 3.6.x to 3.7.x
Powered by GitBook
On this page
  • Github
  • Basic

Was this helpful?

  1. Quick Start

Authenticating

PreviousQuick StartNextAdd an endpoint

Last updated 4 years ago

Was this helpful?

To start using the Janus administration API you need to get a and provide it in every single request using the Authorization header.

You can choose to log in with either github or basic providers.

Github

To login with Github, you need to send a valid Github access token in the Authorization header. This token will be exchanged for a JWT that you can use to make requests to the admin gateway API.

You can choose to either go through the flows to authorize an user on github, or generate a and provide that instead.

Authentication is then performed with the following request:

http -v --json POST localhost:8081/login?provider=github "Authorization:Bearer githubToken"

curl -X "POST" localhost:8081/login?provider=github -H 'Authorization:Bearer githubToken'

You can also configure which organizations/teams will be allowed to log into the Admin API. This can be done with the following :

[web.credentials]
  # The algorithm that you want to use to create your JWT
  algorithm = "HS256"
  # This is the secret that you will use to encrypt your JWT
  secret = "secret key"

  [web.credentials.github]
  # The github owner/organizations that will be allowed to login on the private API
  organizations = ["hellofresh"]
  # A map of the owner/organization and the team name that will have access to the private API
  teams = {hellofresh = "devs"}

Basic

Alternatively, you can authenticate against the admin API using HTTP Basic Authentication.

http -v --json POST localhost:8081/login username=admin password=admin

curl -X "POST" localhost:8081/login -d '{"username": "admin", "password": "admin"}' -H "Content-Type: application/json"

[web.credentials]
  # The algorithm that you want to use to create your JWT
  algorithm = "HS256"
  # This is the secret that you will use to encrypt your JWT
  secret = "secret key"

  [web.credentials.basic]
  # A dictionary with the user and password
  users = [
    {admin = "admin"}
  ]

The username and password default to admin/admin, and should be changed using the following :

JSON Web Token
oAuth2
Personal Access Token
configuration
configuration