Class: Kleister::AuthApi

Inherits:
Object
  • Object
show all
Defined in:
lib/kleister/api/auth_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AuthApi

Returns a new instance of AuthApi.



17
18
19
# File 'lib/kleister/api/auth_api.rb', line 17

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



15
16
17
# File 'lib/kleister/api/auth_api.rb', line 15

def api_client
  @api_client
end

Instance Method Details

#external_callback(provider, opts = {}) ⇒ Notification

Callback for external authentication

Parameters:

  • provider (String)

    An identifier for the auth provider

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :state (String)

    Auth state

  • :code (String)

    Auth code

Returns:



27
28
29
30
# File 'lib/kleister/api/auth_api.rb', line 27

def external_callback(provider, opts = {})
  data, _status_code, _headers = external_callback_with_http_info(provider, opts)
  data
end

#external_callback_with_http_info(provider, opts = {}) ⇒ Array<(Notification, Integer, Hash)>

Callback for external authentication

Parameters:

  • provider (String)

    An identifier for the auth provider

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :state (String)

    Auth state

  • :code (String)

    Auth code

Returns:

  • (Array<(Notification, Integer, Hash)>)

    Notification data, response status code and response headers



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/kleister/api/auth_api.rb', line 38

def external_callback_with_http_info(provider, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.external_callback ...'
  end
  # verify the required parameter 'provider' is set
  if @api_client.config.client_side_validation && provider.nil?
    raise ArgumentError, "Missing the required parameter 'provider' when calling AuthApi.external_callback"
  end

  # resource path
  local_var_path = '/auth/{provider}/callback'.sub('{' + 'provider' + '}', CGI.escape(provider.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:state] = opts[:state] unless opts[:state].nil?
  query_params[:code] = opts[:code] unless opts[:code].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Notification'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    operation: :'AuthApi.external_callback',
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#external_callback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#external_initialize(provider, opts = {}) ⇒ Notification

Initialize the external authentication

Parameters:

  • provider (String)

    An identifier for the auth provider

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :state (String)

    Auth state

Returns:



94
95
96
97
# File 'lib/kleister/api/auth_api.rb', line 94

def external_initialize(provider, opts = {})
  data, _status_code, _headers = external_initialize_with_http_info(provider, opts)
  data
end

#external_initialize_with_http_info(provider, opts = {}) ⇒ Array<(Notification, Integer, Hash)>

Initialize the external authentication

Parameters:

  • provider (String)

    An identifier for the auth provider

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :state (String)

    Auth state

Returns:

  • (Array<(Notification, Integer, Hash)>)

    Notification data, response status code and response headers



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/kleister/api/auth_api.rb', line 104

def external_initialize_with_http_info(provider, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.external_initialize ...'
  end
  # verify the required parameter 'provider' is set
  if @api_client.config.client_side_validation && provider.nil?
    raise ArgumentError, "Missing the required parameter 'provider' when calling AuthApi.external_initialize"
  end

  # resource path
  local_var_path = '/auth/{provider}/initialize'.sub('{' + 'provider' + '}', CGI.escape(provider.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:state] = opts[:state] unless opts[:state].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Notification'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    operation: :'AuthApi.external_initialize',
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#external_initialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#login_auth(auth_login, opts = {}) ⇒ AuthToken

Authenticate an user by credentials

Parameters:

  • auth_login (AuthLogin)

    The credentials to authenticate

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



158
159
160
161
# File 'lib/kleister/api/auth_api.rb', line 158

def (, opts = {})
  data, _status_code, _headers = (, opts)
  data
end

#login_auth_with_http_info(auth_login, opts = {}) ⇒ Array<(AuthToken, Integer, Hash)>

Authenticate an user by credentials

Parameters:

  • auth_login (AuthLogin)

    The credentials to authenticate

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthToken, Integer, Hash)>)

    AuthToken data, response status code and response headers



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/kleister/api/auth_api.rb', line 167

def (, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.login_auth ...'
  end
  # verify the required parameter 'auth_login' is set
  if @api_client.config.client_side_validation && .nil?
    raise ArgumentError, "Missing the required parameter 'auth_login' when calling AuthApi.login_auth"
  end

  # resource path
  local_var_path = '/auth/login'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  unless content_type.nil?
    header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body()

  # return_type
  return_type = opts[:debug_return_type] || 'AuthToken'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    operation: :'AuthApi.login_auth',
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#login_auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#refresh_auth(opts = {}) ⇒ AuthToken

Refresh an auth token before it expires

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



224
225
226
227
# File 'lib/kleister/api/auth_api.rb', line 224

def refresh_auth(opts = {})
  data, _status_code, _headers = refresh_auth_with_http_info(opts)
  data
end

#refresh_auth_with_http_info(opts = {}) ⇒ Array<(AuthToken, Integer, Hash)>

Refresh an auth token before it expires

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthToken, Integer, Hash)>)

    AuthToken data, response status code and response headers



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/kleister/api/auth_api.rb', line 232

def refresh_auth_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.refresh_auth ...'
  end
  # resource path
  local_var_path = '/auth/refresh'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthToken'

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Cookie Basic Header Bearer]

  new_options = opts.merge(
    operation: :'AuthApi.refresh_auth',
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#refresh_auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#verify_auth(opts = {}) ⇒ AuthVerify

Verify validity for an authentication token

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



279
280
281
282
# File 'lib/kleister/api/auth_api.rb', line 279

def verify_auth(opts = {})
  data, _status_code, _headers = verify_auth_with_http_info(opts)
  data
end

#verify_auth_with_http_info(opts = {}) ⇒ Array<(AuthVerify, Integer, Hash)>

Verify validity for an authentication token

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AuthVerify, Integer, Hash)>)

    AuthVerify data, response status code and response headers



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/kleister/api/auth_api.rb', line 287

def verify_auth_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AuthApi.verify_auth ...'
  end
  # resource path
  local_var_path = '/auth/verify'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AuthVerify'

  # auth_names
  auth_names = opts[:debug_auth_names] || %w[Cookie Basic Header Bearer]

  new_options = opts.merge(
    operation: :'AuthApi.verify_auth',
    header_params: header_params,
    query_params: query_params,
    form_params: form_params,
    body: post_body,
    auth_names: auth_names,
    return_type: return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AuthApi#verify_auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end