Browse Source

Merge master. Fixed conflict.

pull/12/head
Marcos Pereira 6 years ago
parent
commit
621fd3d614
  1. 3
      README.md
  2. 7
      keycloak/keycloak_openid.py
  3. 6
      requirements.txt

3
README.md

@ -45,6 +45,9 @@ The documentation for python-keycloak is available on [readthedocs](http://pytho
* [Marcos Pereira](marcospereira.mpj@gmail.com) * [Marcos Pereira](marcospereira.mpj@gmail.com)
* [Martin Devlin](martin.devlin@pearson.com) * [Martin Devlin](martin.devlin@pearson.com)
* [Shon T. Urbas](shon.urbas@gmail.com>) * [Shon T. Urbas](shon.urbas@gmail.com>)
* [Markus Spanier]()
* [Remco Kranenburg]()
* [Remco Kranenburg]()
## Usage ## Usage

7
keycloak/keycloak_openid.py

@ -150,7 +150,7 @@ class KeycloakOpenID:
""" """
return NotImplemented return NotImplemented
def token(self, username, password, grant_type=["password"]):
def token(self, username="", password="", grant_type=["password"], code="", redirect_uri=""):
""" """
The token endpoint is used to obtain tokens. Tokens can either be obtained by The token endpoint is used to obtain tokens. Tokens can either be obtained by
exchanging an authorization code or by supplying credentials directly depending on exchanging an authorization code or by supplying credentials directly depending on
@ -162,11 +162,14 @@ class KeycloakOpenID:
:param username: :param username:
:param password: :param password:
:param grant_type: :param grant_type:
:param code:
:param redirect_uri
:return: :return:
""" """
params_path = {"realm-name": self.realm_name} params_path = {"realm-name": self.realm_name}
payload = {"username": username, "password": password, payload = {"username": username, "password": password,
"client_id": self.client_id, "grant_type": grant_type}
"client_id": self.client_id, "grant_type": grant_type,
"code": code, "redirect_uri": redirect_uri}
payload = self._add_secret_key(payload) payload = self._add_secret_key(payload)
data_raw = self.connection.raw_post(URL_TOKEN.format(**params_path), data_raw = self.connection.raw_post(URL_TOKEN.format(**params_path),

6
requirements.txt

@ -1,4 +1,4 @@
requests==2.18.4
httmock==1.2.5
python-jose==1.4.0
requests>=2.18.4
httmock>=1.2.5
python-jose>=1.4.0
simplejson simplejson
Loading…
Cancel
Save