@@ -42,10 +42,7 @@ def __init__(self):
4242 self .jwks_url = settings .JWKS_URI
4343
4444 self .claims_options = {}
45-
46- logger .info ("CLIENT_ID from env: " + str (settings .CLIENT_ID ))
47- print ("CLIENT_ID from env: " + str (settings .CLIENT_ID ))
48-
45+
4946 if settings .CLIENT_ID is None :
5047 logger .debug (f"CLIENT_ID is not set. No audience check will be performed. " )
5148 else :
@@ -58,7 +55,7 @@ def __init__(self):
5855 async def get_jwks (self ):
5956 logger .debug (f"Fetching JWKS from { self .jwks_url } " )
6057 jwks = None
61- try :
58+ try :
6259 async with httpx .AsyncClient () as client :
6360 response = await client .get (self .jwks_url )
6461 response .raise_for_status ()
@@ -85,7 +82,7 @@ async def authenticate(self, conn):
8582 if conn .scope .get ("path" ) == "/.well-known/agent.json" :
8683 logger .debug ("Bypassing authentication for public agent card path" )
8784 return None
88-
85+
8986 # extract token
9087 token = await self .get_token (conn )
9188 if token is None :
@@ -94,13 +91,9 @@ async def authenticate(self, conn):
9491 # fetch jwks
9592 jwks = await self .get_jwks ()
9693
97- try :
94+ try :
9895 # decode and validate claims
9996 claims = jwt .decode (s = token , key = jwks , claims_options = self .claims_options )
100-
101- logger .info ("Claims before validate: " + str (claims ))
102- print ("Claims before validate: " + str (claims ))
103-
10497 claims .validate ()
10598 logger .debug ("Token successfully validated." )
10699
@@ -148,7 +141,7 @@ async def exchange(self, subject_token: str, audience: str = None, scope: str =
148141 # make token endpoint call
149142 logger .debug ('Performing token exchange' )
150143 async with httpx .AsyncClient () as client :
151- try :
144+ try :
152145 response = await client .post (self .token_url , data = data , headers = headers )
153146 response .raise_for_status () # raise exception if Http status error
154147 token_data = response .json ()
@@ -171,7 +164,7 @@ async def auth_headers(access_token, target_audience = None, target_scopes = Non
171164 access_token = await token_exchanger .exchange (access_token , audience = target_audience , scope = target_scopes )
172165 except AuthenticationError as e :
173166 logging .error (f"Error performing token exchange - returning empty headers: { e } " )
174- return headers #
167+ return headers #
175168 except Exception as e :
176169 logging .debug (f"Error creating token exchanger - will passthrough token" )
177170
0 commit comments