Skip to content

Commit

Permalink
[#1683] Fix is_skill_claim validation for anonymous authentication (#…
Browse files Browse the repository at this point in the history
…1684)

* Fix validation order for anonymous skill claims.

* Fix test
  • Loading branch information
ceciliaavila committed Jun 3, 2021
1 parent 9f7e654 commit 2bd4d42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ def is_skill_claim(claims: Dict[str, object]) -> bool:
:param claims: A dict of claims.
:return bool:
"""
if AuthenticationConstants.VERSION_CLAIM not in claims:
return False

if (
claims.get(AuthenticationConstants.APP_ID_CLAIM, None)
== AuthenticationConstants.ANONYMOUS_SKILL_APP_ID
):
return True

if AuthenticationConstants.VERSION_CLAIM not in claims:
return False

audience = claims.get(AuthenticationConstants.AUDIENCE_CLAIM)

# The audience is https://api.botframework.com and not an appId.
Expand Down
2 changes: 1 addition & 1 deletion libraries/botframework-connector/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TestAuth:

@pytest.mark.asyncio
async def test_claims_validation(self):
claims: List[Dict] = []
claims: List[Dict] = {}
default_auth_config = AuthenticationConfiguration()

# No validator should pass.
Expand Down

0 comments on commit 2bd4d42

Please sign in to comment.