Merge pull request #1650 from betagouv/better-api
Fix authentication token description
This commit is contained in:
commit
7c7f28aea6
3 changed files with 16 additions and 10 deletions
|
@ -1,6 +1,10 @@
|
|||
class API::V1::DossiersController < APIController
|
||||
DEFAULT_PAGE_SIZE = 100
|
||||
|
||||
resource_description do
|
||||
description AUTHENTICATION_TOKEN_DESCRIPTION
|
||||
end
|
||||
|
||||
api :GET, '/procedures/:procedure_id/dossiers/', 'Liste de tous les dossiers d\'une procédure'
|
||||
param :procedure_id, Integer, desc: "L'identifiant de la procédure", required: true
|
||||
param :page, String, desc: "Numéro de la page", required: false
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
class API::V1::ProceduresController < APIController
|
||||
resource_description do
|
||||
description AUTHENTICATION_TOKEN_DESCRIPTION
|
||||
end
|
||||
|
||||
api :GET, '/procedures/:id', 'Informations concernant une procédure'
|
||||
param :id, Integer, desc: "L'identifiant de la procédure", required: true
|
||||
error code: 401, desc: "Non authorisé"
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
class APIController < ApplicationController
|
||||
before_action :authenticate_user
|
||||
before_action :default_format_json
|
||||
|
||||
resource_description do
|
||||
description <<-EOS
|
||||
AUTHENTICATION_TOKEN_DESCRIPTION = <<-EOS
|
||||
L'authentification de l'API se fait via un header HTTP :
|
||||
|
||||
```
|
||||
Authorization: Bearer <Token administrateur>
|
||||
```
|
||||
EOS
|
||||
end
|
||||
|
||||
before_action :authenticate_user
|
||||
before_action :default_format_json
|
||||
|
||||
def authenticate_user
|
||||
if !valid_token?
|
||||
|
|
Loading…
Reference in a new issue