Class: TokenAuth::Api::AuthenticationTokensController

Inherits:
BaseController
  • Object
show all
Includes:
Concerns::CorsSettings
Defined in:
app/controllers/token_auth/api/authentication_tokens_controller.rb

Overview

API to manage Authentication Tokens.

Constant Summary collapse

RESOURCE_TYPE =
"authenticationTokens"

Instance Method Summary collapse

Methods included from Concerns::CorsSettings

#cors_set_access_control_headers

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/token_auth/api/authentication_tokens_controller.rb', line 21

def create
  if configuration_token && authentication_token
    render(json: {
             data: {
               type: RESOURCE_TYPE,
               id: authentication_token.uuid,
               value: authentication_token.value
             }
           },
           status: 201)
  else
    render json: {}, status: 400
  end
end

#optionsObject



17
18
19
# File 'app/controllers/token_auth/api/authentication_tokens_controller.rb', line 17

def options
  render json: {}, status: 200
end