infectnet/infectnet-server

Admin login

Closed this issue · 3 comments

Implement admin login using JWT.

Provide a login endpoint (username + password) that returns a JWT token upon success.

The JWT token can be used for subsequent admin API calls.

The following endpoint should be created to allow administrators to login:

  POST /admin/login

Request

  {
    "username": String,
    "password": String
  }

Response

On success:

  {
    "token": String
  }

Common error format for request failures:

  {
    "error": {
      "code": String,
      "target": String,
      "details": [Error]
    }
  }

Remark:

The admin password can be stored in plain text format for now, but in the future it will be BCrypt'd by the Bootstrapper.