Skip to content

Commit

Permalink
Improve rfc7523 parameters compatibility.
Browse files Browse the repository at this point in the history
ref: #392
  • Loading branch information
lepture committed Oct 18, 2021
1 parent e880f16 commit 38ac0d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions authlib/oauth2/rfc7523/assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def sign_jwt_bearer_assertion(


def client_secret_jwt_sign(client_secret, client_id, token_endpoint, alg='HS256',
header=None, claims=None, **kwargs):
claims=None, header=None, **kwargs):
return _sign(client_secret, client_id, token_endpoint,
alg, header=header, claims=claims, **kwargs)
alg, claims=claims, header=header, **kwargs)


def private_key_jwt_sign(private_key, client_id, token_endpoint, alg='RS256',
header=None, claims=None, **kwargs):
claims=None, header=None, **kwargs):
return _sign(private_key, client_id, token_endpoint,
alg, header=header, claims=claims, **kwargs)
alg, claims=claims, header=header, **kwargs)


def _sign(key, client_id, token_endpoint, alg, claims=None, **kwargs):
Expand Down
14 changes: 6 additions & 8 deletions authlib/oauth2/rfc7523/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,19 @@ class ClientSecretJWT(object):
name = 'client_secret_jwt'
alg = 'HS256'

def __init__(self, token_endpoint=None, alg=None, header=None, claims=None):
def __init__(self, token_endpoint=None, claims=None, header=None):
self.token_endpoint = token_endpoint
self.header = header
self.claims = claims
if alg is not None:
self.alg = alg
self.header = header

def sign(self, auth, token_endpoint):
return client_secret_jwt_sign(
auth.client_secret,
client_id=auth.client_id,
token_endpoint=token_endpoint,
alg=self.alg,
header=self.header,
claims=self.claims,
header=self.header,
alg=self.alg,
)

def __call__(self, auth, method, uri, headers, body):
Expand Down Expand Up @@ -85,9 +83,9 @@ def sign(self, auth, token_endpoint):
auth.client_secret,
client_id=auth.client_id,
token_endpoint=token_endpoint,
alg=self.alg,
header=self.header,
claims=self.claims,
header=self.header,
alg=self.alg,
)


Expand Down

0 comments on commit 38ac0d2

Please sign in to comment.