Browse Source

Merged in sweh/python-keycloak (pull request #25)

Add implementation for method `auth_url`

Approved-by: Marcos Pereira <marcospereira.mpj@gmail.com>
hotfix/merge
Sebastian Wehrmann 6 years ago
committed by Marcos Pereira
parent
commit
72157e4cb1
  1. 6
      keycloak/keycloak_openid.py
  2. 1
      keycloak/urls_patterns.py

6
keycloak/keycloak_openid.py

@ -30,6 +30,7 @@ from .connection import ConnectionManager
from .exceptions import raise_error_from_response, KeycloakGetError, \ from .exceptions import raise_error_from_response, KeycloakGetError, \
KeycloakRPTNotFound, KeycloakAuthorizationConfigError, KeycloakInvalidTokenError KeycloakRPTNotFound, KeycloakAuthorizationConfigError, KeycloakInvalidTokenError
from .urls_patterns import ( from .urls_patterns import (
URL_AUTH,
URL_TOKEN, URL_TOKEN,
URL_USERINFO, URL_USERINFO,
URL_WELL_KNOWN, URL_WELL_KNOWN,
@ -156,7 +157,10 @@ class KeycloakOpenID:
:return: :return:
""" """
return NotImplemented
params_path = {"authorization-endpoint": self.well_know()['authorization_endpoint'],
"client-id": self.client_id,
"redirect-uri": redirect_uri}
return URL_AUTH.format(**params_path)
def token(self, username="", password="", grant_type=["password"], code="", redirect_uri=""): def token(self, username="", password="", grant_type=["password"], code="", redirect_uri=""):
""" """

1
keycloak/urls_patterns.py

@ -29,6 +29,7 @@ URL_LOGOUT = "realms/{realm-name}/protocol/openid-connect/logout"
URL_CERTS = "realms/{realm-name}/protocol/openid-connect/certs" URL_CERTS = "realms/{realm-name}/protocol/openid-connect/certs"
URL_INTROSPECT = "realms/{realm-name}/protocol/openid-connect/token/introspect" URL_INTROSPECT = "realms/{realm-name}/protocol/openid-connect/token/introspect"
URL_ENTITLEMENT = "realms/{realm-name}/authz/entitlement/{resource-server-id}" URL_ENTITLEMENT = "realms/{realm-name}/authz/entitlement/{resource-server-id}"
URL_AUTH = "{authorization-endpoint}?client_id={client-id}&response_type=code&redirect_uri={redirect-uri}"
# ADMIN URLS # ADMIN URLS
URL_ADMIN_USERS = "admin/realms/{realm-name}/users" URL_ADMIN_USERS = "admin/realms/{realm-name}/users"

Loading…
Cancel
Save