Browse Source

fix: Support the auth_url method called with scope & state params now

pull/353/head
Zerek 2 years ago
parent
commit
e4c0ff2c7d
  1. 4
      src/keycloak/keycloak_openid.py
  2. 1
      src/keycloak/urls_patterns.py

4
src/keycloak/keycloak_openid.py

@ -174,7 +174,7 @@ class KeycloakOpenID:
return raise_error_from_response(data_raw, KeycloakGetError) return raise_error_from_response(data_raw, KeycloakGetError)
def auth_url(self, redirect_uri):
def auth_url(self, redirect_uri, scope="email", state=""):
""" """
http://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint http://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint
@ -185,6 +185,8 @@ class KeycloakOpenID:
"authorization-endpoint": self.well_known()["authorization_endpoint"], "authorization-endpoint": self.well_known()["authorization_endpoint"],
"client-id": self.client_id, "client-id": self.client_id,
"redirect-uri": redirect_uri, "redirect-uri": redirect_uri,
"scope": scope,
"state": state,
} }
return URL_AUTH.format(**params_path) return URL_AUTH.format(**params_path)

1
src/keycloak/urls_patterns.py

@ -32,6 +32,7 @@ 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 = ( URL_AUTH = (
"{authorization-endpoint}?client_id={client-id}&response_type=code&redirect_uri={redirect-uri}" "{authorization-endpoint}?client_id={client-id}&response_type=code&redirect_uri={redirect-uri}"
"&scope={scope}&state={state} "
) )
# ADMIN URLS # ADMIN URLS

Loading…
Cancel
Save