Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,6 @@ bb2_venv/
# BB2 ignores
.bluebutton-config.json
.bluebutton-config.yaml

# Snyk Security Extension - AI Rules (auto-generated)
.github/instructions/snyk_rules.instructions.md
2 changes: 1 addition & 1 deletion bluebutton-sample-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"client_id": "<your BB2 client_id here>",
"client_secret": "<your BB2 client_secret here.>",
"callback_url": "https://www.fake.com/your/callback/here",
"version": 2
"version": 3
}
7 changes: 4 additions & 3 deletions cms_bluebutton/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import string
import datetime
import urllib
from cms_bluebutton.tests.fixtures import token_response
from requests_toolbelt.multipart.encoder import MultipartEncoder

from .constants import SDK_HEADERS
Expand Down Expand Up @@ -95,7 +96,7 @@ def generate_pkce_data() -> dict:
code_challenge = base64.urlsafe_b64encode(
hashlib.sha256(verifier.encode("ASCII")).digest()
)
return {"code_challenge": code_challenge.decode("utf-8"), "verifier": verifier}
return {"code_challenge": code_challenge.decode("utf-8"), "code_challenge_method": "S256", "verifier": verifier}


def generate_random_state(num) -> str:
Expand All @@ -116,7 +117,6 @@ def get_access_token_from_code(bb, auth_data, callback_code) -> dict:
"grant_type": "authorization_code",
"redirect_uri": bb.callback_url,
"code_verifier": auth_data["verifier"],
"code_challenge": auth_data["code_challenge"],
}

token_response = _do_post(data, bb, None)
Expand Down Expand Up @@ -146,10 +146,11 @@ def _do_post(data, bb, auth):
mp_encoder = MultipartEncoder(data)
headers = SDK_HEADERS
headers["content-type"] = mp_encoder.content_type

return requests.post(
url=bb.auth_token_url,
data=mp_encoder,
headers=headers
headers=headers,
) if not auth else requests.post(
url=bb.auth_token_url,
data=mp_encoder,
Expand Down
1 change: 0 additions & 1 deletion cms_bluebutton/cms_bluebutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
ROOT_DIR = os.path.abspath(os.curdir) + "/"
DEFAULT_CONFIG_FILE_LOCATION = ROOT_DIR + "./.bluebutton-config.json"


class BlueButton:

def __init__(self, config=DEFAULT_CONFIG_FILE_LOCATION):
Expand Down