Commit Graph

13 Commits

Author SHA1 Message Date
Q.hongtao da5ac25415 Remove six.moves
Remove six.moves Replace the following items with Python 3 style code.
- six.moves.urllib
- six.moves.queue
- six.moves.range
- six.moves.http_client

Subsequent patches will replace other six usages.

Change-Id: I80c713546fcc97391c64e95ef708830632e1ef32
2020-09-22 08:34:20 +08:00
Q.hongtao aba14934e7 Remove usage of six.add_metaclass
With python 3.x, classes can use the metaclass= logic
to not require usage of the six library.

Subsequent patches will replace other six usages.

Change-Id: Iefdc99c338c7aaea18d535426c4676dbedb44f32
2020-09-19 11:37:24 +08:00
Renat Akhmerov c888a46ccc Fix keycloak authentication
* Implement offline access token validation using Keycloak public key.

Closes-bug: #1857871
Change-Id: I0eecec4b4e64381cac005622b16c6d9e4bed4df6
2020-01-14 15:51:06 +07:00
zhufl 6c6771954f Fix duplicated words issue like "from from parsed token"
This is to fix the duplicated words issue like
"Get roles from from parsed token".

Change-Id: I55c96c1eea495d8dfb7e87d8f8498fce5dbbd068
2020-01-06 14:06:46 +08:00
Eyal ae23de737d make user_info_endpoint_url independent of auth_url
Client should be able to create a token using “auth_url” (e.g. ”https://keycloak:7443/auth”)
Server should be able to validate the token using “user_info_endpoint_url” (e.g. “https://cbnd:9443/something/custom”)
also be backward compatible

Change-Id: I437fde40345af52483cc764e5dc6a1f55f1b3e88
2018-10-14 09:21:52 +03:00
Eyal 2c644bdb05 expose the user info url as a configuration
Change-Id: Ia19c00b04a380fe862b7a67061d9ece2b34ad1ab
2018-08-02 15:57:41 +03:00
Idan Narotzki 1ece440ac5 Adding WWW-Authenticate info.
Sometimes when mistral requests are failing with "401 Unauthorized"
against keycloak, the reason are not mentioned in the logs.

In case keycloack return 401 it must provide the www-Authenticate
response header with the reason:
https://www.w3.org/Protocols/HTTP/1.0/spec.html#WWW-Authenticate

This code take care of it by adding the WWW-Authenticate value to
mistral api-log.

Change-Id: I7ae221aaeb2233184bd4818490e72ff662dca5cb
Closes-Bug: #1737500
2018-04-11 07:24:46 +00:00
Mike Fedosin 1c98030a30 Add ssl support for keycloak auth middleware
This patch enables ssl support for keycloak middleware. It adds 3
new config options: 'certfile', 'keyfile' and 'cafile' and substitues
their values to the request to keycloak server.

Change-Id: Id8a771af373cd9d1e198142c21957622f9d0232c
Closes-bug: #1712749
2017-08-24 10:43:48 +03:00
Sharat Sharma b38dceec50 Add a hacking rule for string interpolation at logging
From [1], string interpolation should be delayed to be handled by
the logging code, rather than being done at the point of the logging
call. Add a hacking rule, [M331], to delay the string interpolation.

[1] https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages
Change-Id: Ibf0ac960ae84e935979f93f3a0dec8d774aade78
Closes-Bug: #1705634
2017-07-26 11:13:15 +00:00
Mike Fedosin 02b41f297f Improve keycloak auth module
This patch adds new improvements to the keycloak auth module:

  * Token format is validated before sending it to keycloak server.
  * Realm name is taken from parsed token, 'X-PROJECT-ID' header is
    not required anymore.
  * Added support of user roles - now Mistral understands the
    difference between admin and regular user.
  * Added more detailed error explanations and new unit tests.

Change-Id: I7ac4834f2ecb4cafb9d4fcd154a8cf41a71e6c4a
2017-07-09 16:31:22 +03:00
Sharat Sharma 7664c5d2a1 Remove unused logging import
Change-Id: I6205e7d49277871323f1ff937bd62a14a5e0a788
2017-05-11 11:45:13 +00:00
Cao Xuan Hoang 195f6972e9 Remove logging import unused
This patch removes logging import unused in
mistral/auth/__init__.py
mistral/tests/unit/workbook/v2/test_tasks.py
mistral_tempest_tests/tests/api/v2/*.py

Change-Id: I66233ba2f458801fb1543e5b4001a4300e74cec2
2016-10-11 13:59:59 +07:00
Winson Chan f9c9ca8260 Abstract authentication function
Abstract authentication function so plugins for other authentication
backends can be implemented in cases where keystone is not used. Currently,
mistral is hard coded to support keystone and keycloak. The domain/project
related trust that is specific to keystone is not addressed.

Change-Id: I21994ab20af519b2ba85efd7cbe043547988e5b3
Implements: blueprint mistral-abstract-auth
2016-09-15 23:37:30 +00:00