@@ -62,7 +62,6 @@ async def test_claims_validation(self):
62
62
# No validator should pass.
63
63
await JwtTokenValidation .validate_claims (default_auth_config , claims )
64
64
65
- # ClaimsValidator configured but no exception should pass.
66
65
mock_validator = Mock ()
67
66
auth_with_validator = AuthenticationConfiguration (
68
67
claims_validator = mock_validator
@@ -75,6 +74,34 @@ async def test_claims_validation(self):
75
74
76
75
assert "Invalid claims." in str (excinfo .value )
77
76
77
+ # No validator with not skill cliams should pass.
78
+ default_auth_config .claims_validator = None
79
+ claims : List [Dict ] = {
80
+ AuthenticationConstants .VERSION_CLAIM : "1.0" ,
81
+ AuthenticationConstants .AUDIENCE_CLAIM : "this_bot_id" ,
82
+ AuthenticationConstants .APP_ID_CLAIM : "this_bot_id" , # Skill claims aud!=azp
83
+ }
84
+
85
+ await JwtTokenValidation .validate_claims (default_auth_config , claims )
86
+
87
+ # No validator with skill cliams should fail.
88
+ claims : List [Dict ] = {
89
+ AuthenticationConstants .VERSION_CLAIM : "1.0" ,
90
+ AuthenticationConstants .AUDIENCE_CLAIM : "this_bot_id" ,
91
+ AuthenticationConstants .APP_ID_CLAIM : "not_this_bot_id" , # Skill claims aud!=azp
92
+ }
93
+
94
+ mock_validator .side_effect = PermissionError (
95
+ "Unauthorized Access. Request is not authorized. Skill Claims require validation."
96
+ )
97
+ with pytest .raises (PermissionError ) as excinfo_skill :
98
+ await JwtTokenValidation .validate_claims (auth_with_validator , claims )
99
+
100
+ assert (
101
+ "Unauthorized Access. Request is not authorized. Skill Claims require validation."
102
+ in str (excinfo_skill .value )
103
+ )
104
+
78
105
@pytest .mark .asyncio
79
106
async def test_connector_auth_header_correct_app_id_and_service_url_should_validate (
80
107
self ,
0 commit comments