Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def manager():
return Oauth2Manager(AiohttpSession)
return Request(method, self["token_endpoint"], headers, data=data)
def _build_revoke_request(self, user_creds):
return Request(
method="POST",
headers={"content-type": URLENCODED_CONTENT_TYPE},
url=self["revocation_endpoint"],
data=dict(token=user_creds["access_token"]),
)
async def revoke(self, user_creds):
request = self._build_revoke_request(user_creds)
return await self._send_request(request)
class OpenIdConnectManager(Oauth2Manager, AbstractOpenIdConnectManager):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
async def get_user_info(self, user_creds):
req = self.oauth2_api.userinfo.get()
authorized_req = self.authorize(req, user_creds)
return await self._send_request(authorized_req)
async def get_token_info_jwt(self, user_creds):
""" get token info using id_token_jwt instead of access_token ``self.get_token_info``
Arguments:
user_creds (aiogoogle.auth.creds.UserCreds): user_creds with id_token_jwt item
Returns:
api_key=None,
user_creds=None,
client_creds=None,
):
self.session_factory = session_factory
self.active_session = None
# Keys
self.api_key = api_key
self.user_creds = user_creds
self.client_creds = client_creds
# Auth managers
self.api_key_manager = ApiKeyManager(api_key=self.api_key)
self.oauth2 = Oauth2Manager(
self.session_factory, client_creds=self.client_creds
)
self.openid_connect = OpenIdConnectManager(
self.session_factory, client_creds=self.client_creds
)
# Discovery service
self.discovery_service = GoogleAPI(DISCOVERY_SERVICE_V1_DISCOVERY_DOC)