hyperpocket 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- hyperpocket/auth/activeloop/README.md +8 -0
- hyperpocket/auth/activeloop/__init__.py +0 -0
- hyperpocket/auth/activeloop/context.py +15 -0
- hyperpocket/auth/activeloop/token_context.py +11 -0
- hyperpocket/auth/activeloop/token_handler.py +92 -0
- hyperpocket/auth/activeloop/token_schema.py +9 -0
- hyperpocket/auth/adobe/README.md +8 -0
- hyperpocket/auth/adobe/__init__.py +0 -0
- hyperpocket/auth/adobe/context.py +15 -0
- hyperpocket/auth/adobe/token_context.py +11 -0
- hyperpocket/auth/adobe/token_handler.py +89 -0
- hyperpocket/auth/adobe/token_schema.py +11 -0
- hyperpocket/auth/affinity/README.md +18 -0
- hyperpocket/auth/affinity/__init__.py +0 -0
- hyperpocket/auth/affinity/context.py +15 -0
- hyperpocket/auth/affinity/token_context.py +11 -0
- hyperpocket/auth/affinity/token_handler.py +92 -0
- hyperpocket/auth/affinity/token_schema.py +11 -0
- hyperpocket/auth/agentql/README.md +8 -0
- hyperpocket/auth/agentql/__init__.py +0 -0
- hyperpocket/auth/agentql/context.py +15 -0
- hyperpocket/auth/agentql/token_context.py +11 -0
- hyperpocket/auth/agentql/token_handler.py +92 -0
- hyperpocket/auth/agentql/token_schema.py +9 -0
- hyperpocket/auth/ahrefs/README.md +8 -0
- hyperpocket/auth/ahrefs/__init__.py +0 -0
- hyperpocket/auth/ahrefs/context.py +15 -0
- hyperpocket/auth/ahrefs/token_context.py +11 -0
- hyperpocket/auth/ahrefs/token_handler.py +89 -0
- hyperpocket/auth/ahrefs/token_schema.py +11 -0
- hyperpocket/auth/airtable/README.md +8 -0
- hyperpocket/auth/airtable/__init__.py +0 -0
- hyperpocket/auth/airtable/context.py +15 -0
- hyperpocket/auth/airtable/token_context.py +11 -0
- hyperpocket/auth/airtable/token_handler.py +92 -0
- hyperpocket/auth/airtable/token_schema.py +11 -0
- hyperpocket/auth/alchemy/README.md +8 -0
- hyperpocket/auth/alchemy/__init__.py +0 -0
- hyperpocket/auth/alchemy/context.py +15 -0
- hyperpocket/auth/alchemy/token_context.py +11 -0
- hyperpocket/auth/alchemy/token_handler.py +92 -0
- hyperpocket/auth/alchemy/token_schema.py +11 -0
- hyperpocket/auth/altoviz/README.md +8 -0
- hyperpocket/auth/altoviz/__init__.py +0 -0
- hyperpocket/auth/altoviz/context.py +15 -0
- hyperpocket/auth/altoviz/token_context.py +11 -0
- hyperpocket/auth/altoviz/token_handler.py +92 -0
- hyperpocket/auth/altoviz/token_schema.py +11 -0
- hyperpocket/auth/asana/README.md +13 -0
- hyperpocket/auth/asana/__init__.py +0 -0
- hyperpocket/auth/asana/context.py +15 -0
- hyperpocket/auth/asana/oauth2_context.py +36 -0
- hyperpocket/auth/asana/oauth2_handler.py +158 -0
- hyperpocket/auth/asana/oauth2_schema.py +18 -0
- hyperpocket/auth/bamboohr/README.md +9 -0
- hyperpocket/auth/bamboohr/__init__.py +0 -0
- hyperpocket/auth/bamboohr/context.py +15 -0
- hyperpocket/auth/bamboohr/token_context.py +11 -0
- hyperpocket/auth/bamboohr/token_handler.py +92 -0
- hyperpocket/auth/bamboohr/token_schema.py +11 -0
- hyperpocket/auth/bitbucket/README.md +13 -0
- hyperpocket/auth/bitbucket/__init__.py +0 -0
- hyperpocket/auth/bitbucket/context.py +15 -0
- hyperpocket/auth/bitbucket/oauth2_context.py +33 -0
- hyperpocket/auth/bitbucket/oauth2_handler.py +146 -0
- hyperpocket/auth/bitbucket/oauth2_schema.py +18 -0
- hyperpocket/auth/bitwarden/README.md +9 -0
- hyperpocket/auth/bitwarden/__init__.py +0 -0
- hyperpocket/auth/bitwarden/context.py +15 -0
- hyperpocket/auth/bitwarden/token_context.py +11 -0
- hyperpocket/auth/bitwarden/token_handler.py +92 -0
- hyperpocket/auth/bitwarden/token_schema.py +11 -0
- hyperpocket/auth/brevo/README.md +9 -0
- hyperpocket/auth/brevo/__init__.py +0 -0
- hyperpocket/auth/brevo/context.py +15 -0
- hyperpocket/auth/brevo/token_context.py +11 -0
- hyperpocket/auth/brevo/token_handler.py +89 -0
- hyperpocket/auth/brevo/token_schema.py +11 -0
- hyperpocket/auth/brex/README.md +9 -0
- hyperpocket/auth/brex/__init__.py +0 -0
- hyperpocket/auth/brex/context.py +15 -0
- hyperpocket/auth/brex/token_context.py +11 -0
- hyperpocket/auth/brex/token_handler.py +87 -0
- hyperpocket/auth/brex/token_schema.py +11 -0
- hyperpocket/auth/cal/README.md +9 -0
- hyperpocket/auth/cal/__init__.py +0 -0
- hyperpocket/auth/cal/context.py +15 -0
- hyperpocket/auth/cal/token_context.py +11 -0
- hyperpocket/auth/cal/token_handler.py +85 -0
- hyperpocket/auth/cal/token_schema.py +11 -0
- hyperpocket/auth/calendly/README.md +13 -0
- hyperpocket/auth/canvas/README.md +9 -0
- hyperpocket/auth/canvas/__init__.py +0 -0
- hyperpocket/auth/canvas/context.py +15 -0
- hyperpocket/auth/canvas/token_context.py +11 -0
- hyperpocket/auth/canvas/token_handler.py +89 -0
- hyperpocket/auth/canvas/token_schema.py +11 -0
- hyperpocket/auth/clickup/README.md +9 -0
- hyperpocket/auth/clickup/__init__.py +0 -0
- hyperpocket/auth/clickup/context.py +15 -0
- hyperpocket/auth/clickup/token_context.py +11 -0
- hyperpocket/auth/clickup/token_handler.py +92 -0
- hyperpocket/auth/clickup/token_schema.py +11 -0
- hyperpocket/auth/cloudflare/README.md +9 -0
- hyperpocket/auth/cloudflare/__init__.py +0 -0
- hyperpocket/auth/cloudflare/context.py +15 -0
- hyperpocket/auth/cloudflare/token_context.py +11 -0
- hyperpocket/auth/cloudflare/token_handler.py +92 -0
- hyperpocket/auth/cloudflare/token_schema.py +11 -0
- hyperpocket/auth/dailybot/README.md +9 -0
- hyperpocket/auth/dailybot/__init__.py +0 -0
- hyperpocket/auth/dailybot/context.py +15 -0
- hyperpocket/auth/dailybot/token_context.py +11 -0
- hyperpocket/auth/dailybot/token_handler.py +92 -0
- hyperpocket/auth/dailybot/token_schema.py +11 -0
- hyperpocket/auth/datadog/README.md +9 -0
- hyperpocket/auth/datadog/__init__.py +0 -0
- hyperpocket/auth/datadog/context.py +15 -0
- hyperpocket/auth/datadog/token_context.py +11 -0
- hyperpocket/auth/datadog/token_handler.py +92 -0
- hyperpocket/auth/datadog/token_schema.py +11 -0
- hyperpocket/auth/discord/README.md +14 -0
- hyperpocket/auth/discord/__init__.py +0 -0
- hyperpocket/auth/discord/context.py +15 -0
- hyperpocket/auth/discord/oauth2_context.py +35 -0
- hyperpocket/auth/discord/oauth2_handler.py +133 -0
- hyperpocket/auth/discord/oauth2_schema.py +18 -0
- hyperpocket/auth/discord/token_context.py +11 -0
- hyperpocket/auth/discord/token_handler.py +92 -0
- hyperpocket/auth/discord/token_schema.py +11 -0
- hyperpocket/auth/discordbot/README.md +14 -0
- hyperpocket/auth/discordbot/__init__.py +0 -0
- hyperpocket/auth/discordbot/context.py +15 -0
- hyperpocket/auth/discordbot/token_context.py +11 -0
- hyperpocket/auth/discordbot/token_handler.py +92 -0
- hyperpocket/auth/discordbot/token_schema.py +11 -0
- hyperpocket/auth/elevenlabs/README.md +9 -0
- hyperpocket/auth/elevenlabs/__init__.py +0 -0
- hyperpocket/auth/elevenlabs/context.py +15 -0
- hyperpocket/auth/elevenlabs/token_context.py +11 -0
- hyperpocket/auth/elevenlabs/token_handler.py +92 -0
- hyperpocket/auth/elevenlabs/token_schema.py +11 -0
- hyperpocket/auth/exa/README.md +9 -0
- hyperpocket/auth/exa/__init__.py +0 -0
- hyperpocket/auth/exa/context.py +15 -0
- hyperpocket/auth/exa/token_context.py +11 -0
- hyperpocket/auth/exa/token_handler.py +85 -0
- hyperpocket/auth/exa/token_schema.py +11 -0
- hyperpocket/auth/facebook/README.md +13 -0
- hyperpocket/auth/facebook/__init__.py +0 -0
- hyperpocket/auth/facebook/context.py +15 -0
- hyperpocket/auth/facebook/oauth2_context.py +33 -0
- hyperpocket/auth/facebook/oauth2_handler.py +134 -0
- hyperpocket/auth/facebook/oauth2_schema.py +17 -0
- hyperpocket/auth/finage/README.md +9 -0
- hyperpocket/auth/finage/__init__.py +0 -0
- hyperpocket/auth/finage/context.py +15 -0
- hyperpocket/auth/finage/token_context.py +11 -0
- hyperpocket/auth/finage/token_handler.py +89 -0
- hyperpocket/auth/finage/token_schema.py +11 -0
- hyperpocket/auth/github/README.md +14 -0
- hyperpocket/auth/google/README.md +13 -0
- hyperpocket/auth/gumloop/README.md +9 -0
- hyperpocket/auth/happyrobot/README.md +9 -0
- hyperpocket/auth/happyrobot/__init__.py +0 -0
- hyperpocket/auth/happyrobot/context.py +15 -0
- hyperpocket/auth/happyrobot/token_context.py +11 -0
- hyperpocket/auth/happyrobot/token_handler.py +92 -0
- hyperpocket/auth/happyrobot/token_schema.py +9 -0
- hyperpocket/auth/heygen/README.md +9 -0
- hyperpocket/auth/heygen/__init__.py +0 -0
- hyperpocket/auth/heygen/context.py +15 -0
- hyperpocket/auth/heygen/token_context.py +11 -0
- hyperpocket/auth/heygen/token_handler.py +89 -0
- hyperpocket/auth/heygen/token_schema.py +11 -0
- hyperpocket/auth/hubspot/README.md +14 -0
- hyperpocket/auth/hubspot/__init__.py +0 -0
- hyperpocket/auth/hubspot/context.py +15 -0
- hyperpocket/auth/hubspot/oauth2_context.py +35 -0
- hyperpocket/auth/hubspot/oauth2_handler.py +142 -0
- hyperpocket/auth/hubspot/oauth2_schema.py +17 -0
- hyperpocket/auth/hubspot/token_context.py +11 -0
- hyperpocket/auth/hubspot/token_handler.py +92 -0
- hyperpocket/auth/hubspot/token_schema.py +11 -0
- hyperpocket/auth/jira/README.md +14 -0
- hyperpocket/auth/jira/__init__.py +0 -0
- hyperpocket/auth/jira/context.py +15 -0
- hyperpocket/auth/jira/oauth2_context.py +35 -0
- hyperpocket/auth/jira/oauth2_handler.py +135 -0
- hyperpocket/auth/jira/oauth2_schema.py +17 -0
- hyperpocket/auth/jira/token_context.py +11 -0
- hyperpocket/auth/jira/token_handler.py +87 -0
- hyperpocket/auth/jira/token_schema.py +11 -0
- hyperpocket/auth/klaviyo/README.md +10 -0
- hyperpocket/auth/klaviyo/__init__.py +0 -0
- hyperpocket/auth/klaviyo/context.py +15 -0
- hyperpocket/auth/klaviyo/token_context.py +11 -0
- hyperpocket/auth/klaviyo/token_handler.py +92 -0
- hyperpocket/auth/klaviyo/token_schema.py +11 -0
- hyperpocket/auth/lever/README.md +9 -0
- hyperpocket/auth/lever/__init__.py +0 -0
- hyperpocket/auth/lever/context.py +15 -0
- hyperpocket/auth/lever/token_context.py +11 -0
- hyperpocket/auth/lever/token_handler.py +89 -0
- hyperpocket/auth/lever/token_schema.py +11 -0
- hyperpocket/auth/lever_sandbox/README.md +9 -0
- hyperpocket/auth/lever_sandbox/__init__.py +0 -0
- hyperpocket/auth/lever_sandbox/context.py +15 -0
- hyperpocket/auth/lever_sandbox/token_context.py +11 -0
- hyperpocket/auth/lever_sandbox/token_handler.py +94 -0
- hyperpocket/auth/lever_sandbox/token_schema.py +11 -0
- hyperpocket/auth/linear/README.md +17 -0
- hyperpocket/auth/linear/context.py +1 -1
- hyperpocket/auth/linear/oauth2_context.py +33 -0
- hyperpocket/auth/linear/oauth2_handler.py +155 -0
- hyperpocket/auth/linear/oauth2_schema.py +17 -0
- hyperpocket/auth/linkedin/README.md +16 -0
- hyperpocket/auth/linkedin/__init__.py +0 -0
- hyperpocket/auth/linkedin/context.py +15 -0
- hyperpocket/auth/linkedin/oauth2_context.py +33 -0
- hyperpocket/auth/linkedin/oauth2_handler.py +154 -0
- hyperpocket/auth/linkedin/oauth2_schema.py +18 -0
- hyperpocket/auth/listennotes/README.md +12 -0
- hyperpocket/auth/listennotes/__init__.py +0 -0
- hyperpocket/auth/listennotes/context.py +15 -0
- hyperpocket/auth/listennotes/token_context.py +11 -0
- hyperpocket/auth/listennotes/token_handler.py +92 -0
- hyperpocket/auth/listennotes/token_schema.py +11 -0
- hyperpocket/auth/mailchimp/README.md +16 -0
- hyperpocket/auth/mailchimp/__init__.py +0 -0
- hyperpocket/auth/mailchimp/context.py +15 -0
- hyperpocket/auth/mailchimp/oauth2_context.py +33 -0
- hyperpocket/auth/mailchimp/oauth2_handler.py +153 -0
- hyperpocket/auth/mailchimp/oauth2_schema.py +17 -0
- hyperpocket/auth/mem0/README.md +11 -0
- hyperpocket/auth/mem0/__init__.py +0 -0
- hyperpocket/auth/mem0/context.py +15 -0
- hyperpocket/auth/mem0/token_context.py +11 -0
- hyperpocket/auth/mem0/token_handler.py +87 -0
- hyperpocket/auth/mem0/token_schema.py +11 -0
- hyperpocket/auth/microsoft_clarity/README.md +12 -0
- hyperpocket/auth/microsoft_clarity/__init__.py +0 -0
- hyperpocket/auth/microsoft_clarity/context.py +15 -0
- hyperpocket/auth/microsoft_clarity/token_context.py +15 -0
- hyperpocket/auth/microsoft_clarity/token_handler.py +102 -0
- hyperpocket/auth/microsoft_clarity/token_schema.py +11 -0
- hyperpocket/auth/neon/README.md +11 -0
- hyperpocket/auth/neon/__init__.py +0 -0
- hyperpocket/auth/neon/context.py +15 -0
- hyperpocket/auth/neon/token_context.py +11 -0
- hyperpocket/auth/neon/token_handler.py +87 -0
- hyperpocket/auth/neon/token_schema.py +11 -0
- hyperpocket/auth/ngrok/README.md +12 -0
- hyperpocket/auth/ngrok/__init__.py +0 -0
- hyperpocket/auth/ngrok/context.py +15 -0
- hyperpocket/auth/ngrok/token_context.py +11 -0
- hyperpocket/auth/ngrok/token_handler.py +89 -0
- hyperpocket/auth/ngrok/token_schema.py +11 -0
- hyperpocket/auth/notion/README.md +10 -20
- hyperpocket/auth/notion/oauth2_context.py +33 -0
- hyperpocket/auth/notion/oauth2_handler.py +152 -0
- hyperpocket/auth/notion/oauth2_schema.py +22 -0
- hyperpocket/auth/oncehub/README.md +11 -0
- hyperpocket/auth/oncehub/__init__.py +0 -0
- hyperpocket/auth/oncehub/context.py +15 -0
- hyperpocket/auth/oncehub/token_context.py +11 -0
- hyperpocket/auth/oncehub/token_handler.py +92 -0
- hyperpocket/auth/oncehub/token_schema.py +11 -0
- hyperpocket/auth/pagerduty/README.md +12 -0
- hyperpocket/auth/pagerduty/__init__.py +0 -0
- hyperpocket/auth/pagerduty/context.py +15 -0
- hyperpocket/auth/pagerduty/token_context.py +11 -0
- hyperpocket/auth/pagerduty/token_handler.py +92 -0
- hyperpocket/auth/pagerduty/token_schema.py +11 -0
- hyperpocket/auth/pandadoc/README.md +12 -0
- hyperpocket/auth/pandadoc/__init__.py +0 -0
- hyperpocket/auth/pandadoc/context.py +15 -0
- hyperpocket/auth/pandadoc/token_context.py +11 -0
- hyperpocket/auth/pandadoc/token_handler.py +92 -0
- hyperpocket/auth/pandadoc/token_schema.py +11 -0
- hyperpocket/auth/pipedrive/README.md +12 -0
- hyperpocket/auth/pipedrive/__init__.py +0 -0
- hyperpocket/auth/pipedrive/context.py +15 -0
- hyperpocket/auth/pipedrive/token_context.py +11 -0
- hyperpocket/auth/pipedrive/token_handler.py +92 -0
- hyperpocket/auth/pipedrive/token_schema.py +11 -0
- hyperpocket/auth/posthog/README.md +12 -0
- hyperpocket/auth/posthog/__init__.py +0 -0
- hyperpocket/auth/posthog/context.py +15 -0
- hyperpocket/auth/posthog/token_context.py +11 -0
- hyperpocket/auth/posthog/token_handler.py +92 -0
- hyperpocket/auth/posthog/token_schema.py +11 -0
- hyperpocket/auth/provider.py +57 -0
- hyperpocket/auth/ravenseotools/README.md +12 -0
- hyperpocket/auth/ravenseotools/__init__.py +0 -0
- hyperpocket/auth/ravenseotools/context.py +15 -0
- hyperpocket/auth/ravenseotools/token_context.py +11 -0
- hyperpocket/auth/ravenseotools/token_handler.py +94 -0
- hyperpocket/auth/ravenseotools/token_schema.py +11 -0
- hyperpocket/auth/reddit/README.md +16 -0
- hyperpocket/auth/salesforce/README.md +16 -0
- hyperpocket/auth/salesforce/__init__.py +0 -0
- hyperpocket/auth/salesforce/context.py +15 -0
- hyperpocket/auth/salesforce/oauth2_context.py +33 -0
- hyperpocket/auth/salesforce/oauth2_handler.py +136 -0
- hyperpocket/auth/salesforce/oauth2_schema.py +21 -0
- hyperpocket/auth/sendgrid/README.md +12 -0
- hyperpocket/auth/sendgrid/__init__.py +0 -0
- hyperpocket/auth/sendgrid/context.py +15 -0
- hyperpocket/auth/sendgrid/token_context.py +11 -0
- hyperpocket/auth/sendgrid/token_handler.py +92 -0
- hyperpocket/auth/sendgrid/token_schema.py +11 -0
- hyperpocket/auth/serpapi/README.md +13 -0
- hyperpocket/auth/serpapi/token_context.py +2 -4
- hyperpocket/auth/serpapi/token_handler.py +44 -16
- hyperpocket/auth/slack/README.md +17 -0
- hyperpocket/auth/spotify/README.md +15 -0
- hyperpocket/auth/spotify/__init__.py +0 -0
- hyperpocket/auth/spotify/context.py +15 -0
- hyperpocket/auth/spotify/oauth2_context.py +33 -0
- hyperpocket/auth/spotify/oauth2_handler.py +163 -0
- hyperpocket/auth/spotify/oauth2_schema.py +18 -0
- hyperpocket/auth/stripe/README.md +12 -0
- hyperpocket/auth/stripe/__init__.py +0 -0
- hyperpocket/auth/stripe/context.py +15 -0
- hyperpocket/auth/stripe/token_context.py +11 -0
- hyperpocket/auth/stripe/token_handler.py +89 -0
- hyperpocket/auth/stripe/token_schema.py +11 -0
- hyperpocket/auth/supabase/README.md +11 -0
- hyperpocket/auth/supabase/__init__.py +0 -0
- hyperpocket/auth/supabase/context.py +15 -0
- hyperpocket/auth/supabase/token_context.py +11 -0
- hyperpocket/auth/supabase/token_handler.py +92 -0
- hyperpocket/auth/supabase/token_schema.py +11 -0
- hyperpocket/auth/tavily/README.md +11 -0
- hyperpocket/auth/tavily/__init__.py +0 -0
- hyperpocket/auth/tavily/context.py +15 -0
- hyperpocket/auth/tavily/token_context.py +11 -0
- hyperpocket/auth/tavily/token_handler.py +89 -0
- hyperpocket/auth/tavily/token_schema.py +11 -0
- hyperpocket/auth/timekit/README.md +11 -0
- hyperpocket/auth/timekit/__init__.py +0 -0
- hyperpocket/auth/timekit/context.py +15 -0
- hyperpocket/auth/timekit/token_context.py +11 -0
- hyperpocket/auth/timekit/token_handler.py +92 -0
- hyperpocket/auth/timekit/token_schema.py +11 -0
- hyperpocket/auth/trello/README.md +12 -0
- hyperpocket/auth/trello/__init__.py +0 -0
- hyperpocket/auth/trello/context.py +15 -0
- hyperpocket/auth/trello/token_context.py +11 -0
- hyperpocket/auth/trello/token_handler.py +89 -0
- hyperpocket/auth/trello/token_schema.py +11 -0
- hyperpocket/auth/wandb/README.md +11 -0
- hyperpocket/auth/wandb/__init__.py +0 -0
- hyperpocket/auth/wandb/context.py +15 -0
- hyperpocket/auth/wandb/token_context.py +11 -0
- hyperpocket/auth/wandb/token_handler.py +89 -0
- hyperpocket/auth/wandb/token_schema.py +9 -0
- hyperpocket/auth/workiom/README.md +12 -0
- hyperpocket/auth/workiom/__init__.py +0 -0
- hyperpocket/auth/workiom/context.py +15 -0
- hyperpocket/auth/workiom/token_context.py +11 -0
- hyperpocket/auth/workiom/token_handler.py +92 -0
- hyperpocket/auth/workiom/token_schema.py +11 -0
- hyperpocket/auth/x/README.md +15 -0
- hyperpocket/auth/zoom/README.md +16 -0
- hyperpocket/auth/zoom/__init__.py +0 -0
- hyperpocket/auth/zoom/context.py +15 -0
- hyperpocket/auth/zoom/oauth2_context.py +33 -0
- hyperpocket/auth/zoom/oauth2_handler.py +153 -0
- hyperpocket/auth/zoom/oauth2_schema.py +19 -0
- hyperpocket/cli/__main__.py +4 -1
- hyperpocket/cli/auth_oauth2.py +79 -38
- hyperpocket/cli/auth_token.py +28 -16
- hyperpocket/cli/codegen/auth/__init__.py +4 -1
- hyperpocket/cli/codegen/auth/auth_context_template.py +1 -1
- hyperpocket/cli/codegen/auth/auth_oauth2_context_template.py +5 -4
- hyperpocket/cli/codegen/auth/auth_oauth2_handler_template.py +20 -45
- hyperpocket/cli/codegen/auth/auth_oauth2_schema_template.py +4 -3
- hyperpocket/cli/codegen/auth/auth_token_context_template.py +6 -6
- hyperpocket/cli/codegen/auth/auth_token_handler_template.py +14 -14
- hyperpocket/cli/codegen/auth/auth_token_schema_template.py +3 -3
- hyperpocket/cli/codegen/auth/server_auth_template.py +20 -5
- hyperpocket/cli/codegen/tool/__init__.py +1 -1
- hyperpocket/cli/codegen/tool/tool_main_template.py +1 -0
- hyperpocket/cli/{tool.py → tool_create.py} +24 -19
- hyperpocket/cli/tool_export.py +240 -0
- hyperpocket/config/auth.py +78 -13
- hyperpocket/pocket_core.py +5 -3
- hyperpocket/server/auth/activeloop.py +25 -0
- hyperpocket/server/auth/adobe.py +14 -0
- hyperpocket/server/auth/affinity.py +14 -0
- hyperpocket/server/auth/agentql.py +25 -0
- hyperpocket/server/auth/ahrefs.py +14 -0
- hyperpocket/server/auth/airtable.py +14 -0
- hyperpocket/server/auth/alchemy.py +14 -0
- hyperpocket/server/auth/altoviz.py +14 -0
- hyperpocket/server/auth/asana.py +25 -0
- hyperpocket/server/auth/bamboohr.py +14 -0
- hyperpocket/server/auth/bitbucket.py +25 -0
- hyperpocket/server/auth/bitwarden.py +14 -0
- hyperpocket/server/auth/brevo.py +14 -0
- hyperpocket/server/auth/brex.py +14 -0
- hyperpocket/server/auth/cal.py +14 -0
- hyperpocket/server/auth/canvas.py +14 -0
- hyperpocket/server/auth/clickup.py +14 -0
- hyperpocket/server/auth/cloudflare.py +14 -0
- hyperpocket/server/auth/dailybot.py +14 -0
- hyperpocket/server/auth/datadog.py +14 -0
- hyperpocket/server/auth/discord.py +25 -0
- hyperpocket/server/auth/discordbot.py +14 -0
- hyperpocket/server/auth/elevenlabs.py +14 -0
- hyperpocket/server/auth/exa.py +14 -0
- hyperpocket/server/auth/facebook.py +25 -0
- hyperpocket/server/auth/finage.py +14 -0
- hyperpocket/server/auth/happyrobot.py +26 -0
- hyperpocket/server/auth/heygen.py +14 -0
- hyperpocket/server/auth/hubspot.py +26 -0
- hyperpocket/server/auth/jira.py +25 -0
- hyperpocket/server/auth/klaviyo.py +14 -0
- hyperpocket/server/auth/lever.py +14 -0
- hyperpocket/server/auth/lever_sandbox.py +14 -0
- hyperpocket/server/auth/linear.py +21 -2
- hyperpocket/server/auth/linkedin.py +25 -0
- hyperpocket/server/auth/listennotes.py +14 -0
- hyperpocket/server/auth/mailchimp.py +25 -0
- hyperpocket/server/auth/mem0.py +14 -0
- hyperpocket/server/auth/microsoft_clarity.py +14 -0
- hyperpocket/server/auth/neon.py +14 -0
- hyperpocket/server/auth/ngrok.py +14 -0
- hyperpocket/server/auth/notion.py +20 -1
- hyperpocket/server/auth/oncehub.py +14 -0
- hyperpocket/server/auth/pagerduty.py +14 -0
- hyperpocket/server/auth/pandadoc.py +14 -0
- hyperpocket/server/auth/pipedrive.py +14 -0
- hyperpocket/server/auth/posthog.py +14 -0
- hyperpocket/server/auth/ravenseotools.py +14 -0
- hyperpocket/server/auth/salesforce.py +25 -0
- hyperpocket/server/auth/sendgrid.py +14 -0
- hyperpocket/server/auth/serpapi.py +5 -5
- hyperpocket/server/auth/spotify.py +25 -0
- hyperpocket/server/auth/stripe.py +14 -0
- hyperpocket/server/auth/supabase.py +14 -0
- hyperpocket/server/auth/tavily.py +14 -0
- hyperpocket/server/auth/timekit.py +14 -0
- hyperpocket/server/auth/trello.py +14 -0
- hyperpocket/server/auth/wandb.py +25 -0
- hyperpocket/server/auth/workiom.py +14 -0
- hyperpocket/server/auth/zoom.py +25 -0
- hyperpocket/server/server.py +9 -6
- {hyperpocket-0.3.4.dist-info → hyperpocket-0.3.5.dist-info}/METADATA +1 -1
- hyperpocket-0.3.5.dist-info/RECORD +587 -0
- hyperpocket-0.3.4.dist-info/RECORD +0 -163
- {hyperpocket-0.3.4.dist-info → hyperpocket-0.3.5.dist-info}/WHEEL +0 -0
- {hyperpocket-0.3.4.dist-info → hyperpocket-0.3.5.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from urllib.parse import urljoin, urlencode
|
3
|
+
|
4
|
+
import httpx
|
5
|
+
|
6
|
+
from hyperpocket.auth import AuthProvider
|
7
|
+
from hyperpocket.auth.context import AuthContext
|
8
|
+
from hyperpocket.auth.handler import AuthHandlerInterface
|
9
|
+
from hyperpocket.auth.zoom.oauth2_context import ZoomOAuth2AuthContext
|
10
|
+
from hyperpocket.auth.zoom.oauth2_schema import ZoomOAuth2Response, ZoomOAuth2Request
|
11
|
+
from hyperpocket.config import config
|
12
|
+
from hyperpocket.futures import FutureStore
|
13
|
+
|
14
|
+
|
15
|
+
class ZoomOAuth2AuthHandler(AuthHandlerInterface):
|
16
|
+
# Currently only support public app type. Device authorization for private app is not supported.
|
17
|
+
_ZOOM_OAUTH_URL: str = (
|
18
|
+
"https://zoom.us/oauth/authorize" # e.g. "https://slack.com/oauth/v2/authorize"
|
19
|
+
)
|
20
|
+
_ZOOM_TOKEN_URL: str = (
|
21
|
+
"https://zoom.us/oauth/token" # e.g. "https://slack.com/api/oauth.v2.access"
|
22
|
+
)
|
23
|
+
|
24
|
+
name: str = "zoom-oauth2"
|
25
|
+
description: str = "This handler is used to authenticate users using the Zoom OAuth2 authentication method."
|
26
|
+
scoped: bool = True
|
27
|
+
|
28
|
+
@staticmethod
|
29
|
+
def provider() -> AuthProvider:
|
30
|
+
return AuthProvider.ZOOM
|
31
|
+
|
32
|
+
@staticmethod
|
33
|
+
def provider_default() -> bool:
|
34
|
+
return True
|
35
|
+
|
36
|
+
@staticmethod
|
37
|
+
def recommended_scopes() -> set[str]:
|
38
|
+
"""
|
39
|
+
This method returns a set of recommended scopes for the service.
|
40
|
+
If the service has a recommended scope, it should be returned here.
|
41
|
+
Example:
|
42
|
+
return {
|
43
|
+
"channels:history",
|
44
|
+
"channels:read",
|
45
|
+
"chat:write",
|
46
|
+
"groups:history",
|
47
|
+
"groups:read",
|
48
|
+
"im:history",
|
49
|
+
"mpim:history",
|
50
|
+
"reactions:read",
|
51
|
+
"reactions:write",
|
52
|
+
}
|
53
|
+
"""
|
54
|
+
return set()
|
55
|
+
|
56
|
+
def prepare(
|
57
|
+
self,
|
58
|
+
auth_req: ZoomOAuth2Request,
|
59
|
+
thread_id: str,
|
60
|
+
profile: str,
|
61
|
+
future_uid: str,
|
62
|
+
*args,
|
63
|
+
**kwargs,
|
64
|
+
) -> str:
|
65
|
+
redirect_uri = urljoin(
|
66
|
+
config().public_base_url + "/",
|
67
|
+
f"{config().callback_url_rewrite_prefix}/auth/zoom/oauth2/callback",
|
68
|
+
)
|
69
|
+
auth_url = self._make_auth_url(
|
70
|
+
req=auth_req, redirect_uri=redirect_uri, state=future_uid
|
71
|
+
)
|
72
|
+
|
73
|
+
FutureStore.create_future(
|
74
|
+
future_uid,
|
75
|
+
data={
|
76
|
+
"redirect_uri": redirect_uri,
|
77
|
+
"thread_id": thread_id,
|
78
|
+
"profile": profile,
|
79
|
+
},
|
80
|
+
)
|
81
|
+
|
82
|
+
return f"User needs to authenticate using the following URL: {auth_url}"
|
83
|
+
|
84
|
+
async def authenticate(
|
85
|
+
self, auth_req: ZoomOAuth2Request, future_uid: str, *args, **kwargs
|
86
|
+
) -> AuthContext:
|
87
|
+
future_data = FutureStore.get_future(future_uid)
|
88
|
+
auth_code = await future_data.future
|
89
|
+
|
90
|
+
async with httpx.AsyncClient() as client:
|
91
|
+
resp = await client.post(
|
92
|
+
url=self._ZOOM_TOKEN_URL,
|
93
|
+
data={
|
94
|
+
"client_id": auth_req.client_id,
|
95
|
+
"client_secret": auth_req.client_secret,
|
96
|
+
"code": auth_code,
|
97
|
+
"redirect_uri": future_data.data["redirect_uri"],
|
98
|
+
},
|
99
|
+
)
|
100
|
+
resp.raise_for_status()
|
101
|
+
resp_json = resp.json()
|
102
|
+
resp_typed = ZoomOAuth2Response(**resp_json)
|
103
|
+
return ZoomOAuth2AuthContext.from_zoom_oauth2_response(resp_typed)
|
104
|
+
|
105
|
+
async def refresh(
|
106
|
+
self, auth_req: ZoomOAuth2Request, context: AuthContext, *args, **kwargs
|
107
|
+
) -> AuthContext:
|
108
|
+
zoom_context: ZoomOAuth2AuthContext = context
|
109
|
+
refresh_token = zoom_context.refresh_token
|
110
|
+
|
111
|
+
async with httpx.AsyncClient() as client:
|
112
|
+
resp = await client.post(
|
113
|
+
url=self._ZOOM_TOKEN_URL,
|
114
|
+
data={
|
115
|
+
"grant_type": "refresh_token",
|
116
|
+
"refresh_token": refresh_token,
|
117
|
+
},
|
118
|
+
)
|
119
|
+
|
120
|
+
resp.raise_for_status()
|
121
|
+
resp_json = resp.json()
|
122
|
+
|
123
|
+
new_resp = ZoomOAuth2Response(
|
124
|
+
**{
|
125
|
+
"access_token": resp_json["access_token"],
|
126
|
+
"refresh_token": resp_json["refresh_token"],
|
127
|
+
"expires_in": resp_json["expires_in"],
|
128
|
+
"token_type": resp_json["token_type"],
|
129
|
+
"scope": resp_json["scope"],
|
130
|
+
"api_url": resp_json["api_url"],
|
131
|
+
}
|
132
|
+
)
|
133
|
+
|
134
|
+
return ZoomOAuth2AuthContext.from_zoom_oauth2_response(new_resp)
|
135
|
+
|
136
|
+
def _make_auth_url(self, req: ZoomOAuth2Request, redirect_uri: str, state: str):
|
137
|
+
params = {
|
138
|
+
"scope": " ".join(req.auth_scopes),
|
139
|
+
"client_id": req.client_id,
|
140
|
+
"redirect_uri": redirect_uri,
|
141
|
+
"state": state,
|
142
|
+
}
|
143
|
+
auth_url = f"{self._ZOOM_OAUTH_URL}?{urlencode(params)}"
|
144
|
+
return auth_url
|
145
|
+
|
146
|
+
def make_request(
|
147
|
+
self, auth_scopes: Optional[list[str]] = None, **kwargs
|
148
|
+
) -> ZoomOAuth2Request:
|
149
|
+
return ZoomOAuth2Request(
|
150
|
+
auth_scopes=auth_scopes,
|
151
|
+
client_id=config().auth.zoom.client_id,
|
152
|
+
client_secret=config().auth.zoom.client_secret,
|
153
|
+
)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
from pydantic import BaseModel, Field
|
4
|
+
|
5
|
+
from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
|
6
|
+
|
7
|
+
|
8
|
+
class ZoomOAuth2Request(AuthenticateRequest):
|
9
|
+
client_id: str
|
10
|
+
client_secret: str
|
11
|
+
|
12
|
+
|
13
|
+
class ZoomOAuth2Response(AuthenticateResponse):
|
14
|
+
access_token: str
|
15
|
+
expires_in: int
|
16
|
+
refresh_token: Optional[str] = Field(default=None)
|
17
|
+
token_type: str
|
18
|
+
scope: Optional[str] = None
|
19
|
+
api_url: Optional[str] = None
|
hyperpocket/cli/__main__.py
CHANGED
@@ -6,7 +6,9 @@ from hyperpocket.cli.sync import sync
|
|
6
6
|
from hyperpocket.cli.eject import eject
|
7
7
|
from hyperpocket.cli.auth_token import create_token_auth_template
|
8
8
|
from hyperpocket.cli.auth_oauth2 import create_oauth2_auth_template
|
9
|
-
from hyperpocket.cli.
|
9
|
+
from hyperpocket.cli.tool_create import create_tool_template, build_tool
|
10
|
+
from hyperpocket.cli.tool_export import export_tool
|
11
|
+
|
10
12
|
|
11
13
|
@click.group()
|
12
14
|
def cli():
|
@@ -23,6 +25,7 @@ devtool.add_command(create_token_auth_template)
|
|
23
25
|
devtool.add_command(create_oauth2_auth_template)
|
24
26
|
devtool.add_command(create_tool_template)
|
25
27
|
devtool.add_command(build_tool)
|
28
|
+
devtool.add_command(export_tool)
|
26
29
|
|
27
30
|
cli.add_command(pull)
|
28
31
|
cli.add_command(sync)
|
hyperpocket/cli/auth_oauth2.py
CHANGED
@@ -1,90 +1,131 @@
|
|
1
1
|
import os
|
2
2
|
import click
|
3
3
|
from pathlib import Path
|
4
|
-
from hyperpocket.cli.codegen.auth import
|
4
|
+
from hyperpocket.cli.codegen.auth import (
|
5
|
+
get_auth_context_template,
|
6
|
+
get_auth_oauth2_context_template,
|
7
|
+
get_auth_oauth2_handler_template,
|
8
|
+
get_auth_oauth2_schema_template,
|
9
|
+
get_server_auth_oauth2_template,
|
10
|
+
)
|
11
|
+
|
5
12
|
|
6
13
|
@click.command()
|
7
|
-
@click.argument(
|
8
|
-
@click.option(
|
14
|
+
@click.argument("service_name", type=str)
|
15
|
+
@click.option("--force", is_flag=True, default=False)
|
9
16
|
def create_oauth2_auth_template(service_name, force):
|
10
17
|
## Validate service_name
|
11
|
-
if not service_name.islower() or not service_name.replace(
|
12
|
-
raise ValueError(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
if not service_name.islower() or not service_name.replace("_", "").isalnum():
|
19
|
+
raise ValueError(
|
20
|
+
"service_name must be lowercase and contain only letters, numbers, and underscores"
|
21
|
+
)
|
22
|
+
|
23
|
+
capitalized_service_name = service_name.capitalize()
|
24
|
+
if "_" in service_name:
|
25
|
+
capitalized_service_name = "".join(
|
26
|
+
[word.capitalize() for word in service_name.split("_")]
|
27
|
+
)
|
28
|
+
|
18
29
|
## Get the current working directory
|
19
30
|
cwd = Path.cwd()
|
20
31
|
parent_path = cwd.parent
|
21
|
-
|
32
|
+
|
22
33
|
generate_server_auth(service_name, parent_path, force)
|
23
34
|
generate_hyperpocket_auth_dir(service_name, parent_path, force)
|
24
|
-
generate_auth_context(service_name,
|
25
|
-
generate_auth_oauth2_context(
|
26
|
-
|
27
|
-
|
35
|
+
generate_auth_context(service_name, capitalized_service_name, parent_path, force)
|
36
|
+
generate_auth_oauth2_context(
|
37
|
+
service_name, capitalized_service_name, parent_path, force
|
38
|
+
)
|
39
|
+
generate_auth_oauth2_handler(
|
40
|
+
service_name, capitalized_service_name, parent_path, force
|
41
|
+
)
|
42
|
+
generate_auth_oauth2_schema(
|
43
|
+
service_name, capitalized_service_name, parent_path, force
|
44
|
+
)
|
28
45
|
##TODO: Add service to hyperpocket/auth/provider
|
29
46
|
|
47
|
+
|
30
48
|
def generate_server_auth(service_name, parent_path, force):
|
31
49
|
print(f"Generating server/auth for '{service_name}'.")
|
32
|
-
output_from_parsed_template = get_server_auth_oauth2_template().render(
|
33
|
-
|
50
|
+
output_from_parsed_template = get_server_auth_oauth2_template().render(
|
51
|
+
service_name=service_name
|
52
|
+
)
|
53
|
+
output_path = parent_path / f"hyperpocket/hyperpocket/server/auth/{service_name}.py"
|
34
54
|
if not output_path.exists() or force:
|
35
55
|
with open(output_path, "w") as f:
|
36
56
|
f.write(output_from_parsed_template)
|
37
57
|
|
58
|
+
|
38
59
|
def generate_hyperpocket_auth_dir(service_name, parent_path, force):
|
39
|
-
if not os.path.exists(parent_path / f
|
40
|
-
os.makedirs(parent_path / f
|
41
|
-
|
42
|
-
output_path =
|
60
|
+
if not os.path.exists(parent_path / f"hyperpocket/hyperpocket/auth/{service_name}"):
|
61
|
+
os.makedirs(parent_path / f"hyperpocket/hyperpocket/auth/{service_name}")
|
62
|
+
|
63
|
+
output_path = (
|
64
|
+
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/__init__.py"
|
65
|
+
)
|
43
66
|
if not output_path.exists() or force:
|
44
67
|
with open(output_path, "w") as f:
|
45
68
|
pass
|
46
69
|
|
47
|
-
|
70
|
+
|
71
|
+
def generate_auth_context(service_name, capitalized_service_name, parent_path, force):
|
48
72
|
print(f"Generating auth/context for '{service_name}'.")
|
49
73
|
output_from_parsed_template = get_auth_context_template().render(
|
50
|
-
capitalized_service_name=
|
51
|
-
upper_service_name=service_name.upper()
|
74
|
+
capitalized_service_name=capitalized_service_name,
|
75
|
+
upper_service_name=service_name.upper(),
|
76
|
+
)
|
77
|
+
output_path = (
|
78
|
+
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/context.py"
|
52
79
|
)
|
53
|
-
output_path = parent_path / f'hyperpocket/hyperpocket/auth/{service_name}/context.py'
|
54
80
|
if not output_path.exists() or force:
|
55
81
|
with open(output_path, "w") as f:
|
56
82
|
f.write(output_from_parsed_template)
|
57
83
|
|
58
|
-
|
84
|
+
|
85
|
+
def generate_auth_oauth2_context(
|
86
|
+
service_name, capitalized_service_name, parent_path, force
|
87
|
+
):
|
59
88
|
print(f"Generating auth/oauth2 context for '{service_name}'.")
|
60
89
|
output_from_parsed_template = get_auth_oauth2_context_template().render(
|
61
|
-
service_name
|
62
|
-
capitalized_service_name=
|
90
|
+
service_name=service_name,
|
91
|
+
capitalized_service_name=capitalized_service_name,
|
92
|
+
)
|
93
|
+
output_path = (
|
94
|
+
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/oauth2_context.py"
|
63
95
|
)
|
64
|
-
output_path = parent_path / f'hyperpocket/hyperpocket/auth/{service_name}/oauth2_context.py'
|
65
96
|
if not output_path.exists() or force:
|
66
97
|
with open(output_path, "w") as f:
|
67
98
|
f.write(output_from_parsed_template)
|
68
99
|
|
69
|
-
|
100
|
+
|
101
|
+
def generate_auth_oauth2_handler(
|
102
|
+
service_name, capitalized_service_name, parent_path, force
|
103
|
+
):
|
70
104
|
print(f"Generating auth/oauth2 handler for '{service_name}'.")
|
71
105
|
output_from_parsed_template = get_auth_oauth2_handler_template().render(
|
72
|
-
service_name
|
73
|
-
auth_handler_name
|
74
|
-
capitalized_service_name=
|
75
|
-
upper_service_name=service_name.upper()
|
106
|
+
service_name=service_name,
|
107
|
+
auth_handler_name=service_name.replace("_", "-"),
|
108
|
+
capitalized_service_name=capitalized_service_name,
|
109
|
+
upper_service_name=service_name.upper(),
|
110
|
+
)
|
111
|
+
output_path = (
|
112
|
+
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/oauth2_handler.py"
|
76
113
|
)
|
77
|
-
output_path = parent_path / f'hyperpocket/hyperpocket/auth/{service_name}/oauth2_handler.py'
|
78
114
|
if not output_path.exists() or force:
|
79
115
|
with open(output_path, "w") as f:
|
80
116
|
f.write(output_from_parsed_template)
|
81
117
|
|
82
|
-
|
118
|
+
|
119
|
+
def generate_auth_oauth2_schema(
|
120
|
+
service_name, capitalized_service_name, parent_path, force
|
121
|
+
):
|
83
122
|
print(f"Generating auth/oauth2 schema for '{service_name}'.")
|
84
123
|
output_from_parsed_template = get_auth_oauth2_schema_template().render(
|
85
|
-
capitalized_service_name=
|
124
|
+
capitalized_service_name=capitalized_service_name,
|
125
|
+
)
|
126
|
+
output_path = (
|
127
|
+
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/oauth2_schema.py"
|
86
128
|
)
|
87
|
-
output_path = parent_path / f'hyperpocket/hyperpocket/auth/{service_name}/oauth2_schema.py'
|
88
129
|
if not output_path.exists() or force:
|
89
130
|
with open(output_path, "w") as f:
|
90
131
|
f.write(output_from_parsed_template)
|
hyperpocket/cli/auth_token.py
CHANGED
@@ -17,14 +17,14 @@ from hyperpocket.cli.codegen.auth import (
|
|
17
17
|
@click.option("--force", is_flag=True, default=False)
|
18
18
|
def create_token_auth_template(service_name, force):
|
19
19
|
## Validate service_name
|
20
|
-
if not service_name.islower() or not service_name.replace("_", "").
|
20
|
+
if not service_name.islower() or not service_name.replace("_", "").isalnum():
|
21
21
|
raise ValueError(
|
22
|
-
"service_name must be lowercase and contain only letters and underscores"
|
22
|
+
"service_name must be lowercase and contain only letters, numbers, and underscores"
|
23
23
|
)
|
24
24
|
|
25
|
-
|
25
|
+
capitalized_service_name = service_name.capitalize()
|
26
26
|
if "_" in service_name:
|
27
|
-
|
27
|
+
capitalized_service_name = "".join(
|
28
28
|
[word.capitalize() for word in service_name.split("_")]
|
29
29
|
)
|
30
30
|
|
@@ -34,10 +34,16 @@ def create_token_auth_template(service_name, force):
|
|
34
34
|
|
35
35
|
generate_server_auth(service_name, parent_path, force)
|
36
36
|
generate_hyperpocket_auth_dir(service_name, parent_path, force)
|
37
|
-
generate_auth_context(service_name,
|
38
|
-
generate_auth_token_context(
|
39
|
-
|
40
|
-
|
37
|
+
generate_auth_context(service_name, capitalized_service_name, parent_path, force)
|
38
|
+
generate_auth_token_context(
|
39
|
+
service_name, capitalized_service_name, parent_path, force
|
40
|
+
)
|
41
|
+
generate_auth_token_handler(
|
42
|
+
service_name, capitalized_service_name, parent_path, force
|
43
|
+
)
|
44
|
+
generate_auth_token_schema(
|
45
|
+
service_name, capitalized_service_name, parent_path, force
|
46
|
+
)
|
41
47
|
##TODO: Add service to hyperpocket/auth/provider
|
42
48
|
|
43
49
|
|
@@ -64,10 +70,10 @@ def generate_hyperpocket_auth_dir(service_name, parent_path, force):
|
|
64
70
|
pass
|
65
71
|
|
66
72
|
|
67
|
-
def generate_auth_context(service_name,
|
73
|
+
def generate_auth_context(service_name, capitalized_service_name, parent_path, force):
|
68
74
|
print(f"Generating auth/context for '{service_name}'.")
|
69
75
|
output_from_parsed_template = get_auth_context_template().render(
|
70
|
-
|
76
|
+
capitalized_service_name=capitalized_service_name,
|
71
77
|
upper_service_name=service_name.upper(),
|
72
78
|
)
|
73
79
|
output_path = (
|
@@ -78,11 +84,13 @@ def generate_auth_context(service_name, capitliazed_service_name, parent_path, f
|
|
78
84
|
f.write(output_from_parsed_template)
|
79
85
|
|
80
86
|
|
81
|
-
def generate_auth_token_context(
|
87
|
+
def generate_auth_token_context(
|
88
|
+
service_name, capitalized_service_name, parent_path, force
|
89
|
+
):
|
82
90
|
print(f"Generating auth/token context for '{service_name}'.")
|
83
91
|
output_from_parsed_template = get_auth_token_context_template().render(
|
84
92
|
service_name=service_name,
|
85
|
-
|
93
|
+
capitalized_service_name=capitalized_service_name,
|
86
94
|
)
|
87
95
|
output_path = (
|
88
96
|
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/token_context.py"
|
@@ -92,12 +100,14 @@ def generate_auth_token_context(service_name, capitliazed_service_name, parent_p
|
|
92
100
|
f.write(output_from_parsed_template)
|
93
101
|
|
94
102
|
|
95
|
-
def generate_auth_token_handler(
|
103
|
+
def generate_auth_token_handler(
|
104
|
+
service_name, capitalized_service_name, parent_path, force
|
105
|
+
):
|
96
106
|
print(f"Generating auth/token handler for '{service_name}'.")
|
97
107
|
output_from_parsed_template = get_auth_token_handler_template().render(
|
98
108
|
service_name=service_name,
|
99
109
|
auth_handler_name=service_name.replace("_", "-"),
|
100
|
-
|
110
|
+
capitalized_service_name=capitalized_service_name,
|
101
111
|
upper_service_name=service_name.upper(),
|
102
112
|
)
|
103
113
|
output_path = (
|
@@ -108,10 +118,12 @@ def generate_auth_token_handler(service_name, capitliazed_service_name, parent_p
|
|
108
118
|
f.write(output_from_parsed_template)
|
109
119
|
|
110
120
|
|
111
|
-
def generate_auth_token_schema(
|
121
|
+
def generate_auth_token_schema(
|
122
|
+
service_name, capitalized_service_name, parent_path, force
|
123
|
+
):
|
112
124
|
print(f"Generating auth/token schema for '{service_name}'.")
|
113
125
|
output_from_parsed_template = get_auth_token_schema_template().render(
|
114
|
-
|
126
|
+
capitalized_service_name=capitalized_service_name,
|
115
127
|
)
|
116
128
|
output_path = (
|
117
129
|
parent_path / f"hyperpocket/hyperpocket/auth/{service_name}/token_schema.py"
|
@@ -5,7 +5,10 @@ from .auth_oauth2_schema_template import get_auth_oauth2_schema_template
|
|
5
5
|
from .auth_token_context_template import get_auth_token_context_template
|
6
6
|
from .auth_token_handler_template import get_auth_token_handler_template
|
7
7
|
from .auth_token_schema_template import get_auth_token_schema_template
|
8
|
-
from .server_auth_template import
|
8
|
+
from .server_auth_template import (
|
9
|
+
get_server_auth_token_template,
|
10
|
+
get_server_auth_oauth2_template,
|
11
|
+
)
|
9
12
|
|
10
13
|
__all__ = [
|
11
14
|
"get_auth_context_template",
|
@@ -4,7 +4,7 @@ from jinja2 import Template
|
|
4
4
|
def get_auth_context_template() -> Template:
|
5
5
|
return Template("""
|
6
6
|
from hyperpocket.auth.context import AuthContext
|
7
|
-
class {{
|
7
|
+
class {{ capitalized_service_name }}AuthContext(AuthContext):
|
8
8
|
_ACCESS_TOKEN_KEY: str = "{{ upper_service_name }}_TOKEN"
|
9
9
|
def to_dict(self) -> dict[str, str]:
|
10
10
|
return {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
from jinja2 import Template
|
2
2
|
|
3
|
+
|
3
4
|
def get_auth_oauth2_context_template() -> Template:
|
4
|
-
return Template(
|
5
|
+
return Template("""\
|
5
6
|
from datetime import datetime, timedelta, timezone
|
6
7
|
from typing import Optional
|
7
8
|
|
@@ -16,7 +17,7 @@ class {{ capitalized_service_name }}OAuth2AuthContext({{ capitalized_service_nam
|
|
16
17
|
|
17
18
|
@classmethod
|
18
19
|
def from_{{ service_name }}_oauth2_response(cls, response: {{ capitalized_service_name }}OAuth2Response):
|
19
|
-
description = f'{{ capitalized_service_name }} OAuth2 Context logged in
|
20
|
+
description = f'{{ capitalized_service_name }} OAuth2 Context logged in'
|
20
21
|
now = datetime.now(tz=timezone.utc)
|
21
22
|
|
22
23
|
access_token = response.access_token
|
@@ -24,7 +25,7 @@ class {{ capitalized_service_name }}OAuth2AuthContext({{ capitalized_service_nam
|
|
24
25
|
expires_in = response.expires_in
|
25
26
|
|
26
27
|
if expires_in:
|
27
|
-
expires_at = now + timedelta(seconds=response.
|
28
|
+
expires_at = now + timedelta(seconds=response.expires_in)
|
28
29
|
else:
|
29
30
|
expires_at = None
|
30
31
|
|
@@ -35,4 +36,4 @@ class {{ capitalized_service_name }}OAuth2AuthContext({{ capitalized_service_nam
|
|
35
36
|
description=description,
|
36
37
|
detail=response,
|
37
38
|
)
|
38
|
-
|
39
|
+
""")
|
@@ -1,7 +1,8 @@
|
|
1
1
|
from jinja2 import Template
|
2
2
|
|
3
|
+
|
3
4
|
def get_auth_oauth2_handler_template() -> Template:
|
4
|
-
return Template('''
|
5
|
+
return Template('''\
|
5
6
|
from typing import Optional
|
6
7
|
from urllib.parse import urljoin, urlencode
|
7
8
|
|
@@ -12,7 +13,7 @@ from hyperpocket.auth.context import AuthContext
|
|
12
13
|
from hyperpocket.auth.handler import AuthHandlerInterface
|
13
14
|
from hyperpocket.auth.{{ service_name }}.oauth2_context import {{ capitalized_service_name }}OAuth2AuthContext
|
14
15
|
from hyperpocket.auth.{{ service_name }}.oauth2_schema import {{ capitalized_service_name }}OAuth2Response, {{ capitalized_service_name }}OAuth2Request
|
15
|
-
from hyperpocket.config import config
|
16
|
+
from hyperpocket.config import config
|
16
17
|
from hyperpocket.futures import FutureStore
|
17
18
|
|
18
19
|
|
@@ -55,10 +56,9 @@ class {{ capitalized_service_name }}OAuth2AuthHandler(AuthHandlerInterface):
|
|
55
56
|
def prepare(self, auth_req: {{ capitalized_service_name }}OAuth2Request, thread_id: str, profile: str,
|
56
57
|
future_uid: str, *args, **kwargs) -> str:
|
57
58
|
redirect_uri = urljoin(
|
58
|
-
config.public_base_url + "/",
|
59
|
-
f"{config.callback_url_rewrite_prefix}/auth/{{ service_name }}/oauth2/callback",
|
59
|
+
config().public_base_url + "/",
|
60
|
+
f"{config().callback_url_rewrite_prefix}/auth/{{ service_name }}/oauth2/callback",
|
60
61
|
)
|
61
|
-
print(f"redirect_uri: {redirect_uri}")
|
62
62
|
auth_url = self._make_auth_url(req=auth_req, redirect_uri=redirect_uri, state=future_uid)
|
63
63
|
|
64
64
|
FutureStore.create_future(future_uid, data={
|
@@ -83,65 +83,40 @@ class {{ capitalized_service_name }}OAuth2AuthHandler(AuthHandlerInterface):
|
|
83
83
|
'redirect_uri': future_data.data["redirect_uri"],
|
84
84
|
}
|
85
85
|
)
|
86
|
-
|
87
|
-
raise Exception(f"failed to authenticate. status_code : {resp.status_code}")
|
88
|
-
|
86
|
+
resp.raise_for_status()
|
89
87
|
resp_json = resp.json()
|
90
|
-
if resp_json["ok"] is False:
|
91
|
-
raise Exception(f"failed to authenticate. error : {resp_json['error']}")
|
92
|
-
|
93
88
|
resp_typed = {{ capitalized_service_name }}OAuth2Response(**resp_json)
|
94
89
|
return {{ capitalized_service_name }}OAuth2AuthContext.from_{{ service_name }}_oauth2_response(resp_typed)
|
95
90
|
|
96
91
|
async def refresh(self, auth_req: {{ capitalized_service_name }}OAuth2Request, context: AuthContext, *args, **kwargs) -> AuthContext:
|
97
92
|
{{ service_name }}_context: {{ capitalized_service_name }}OAuth2AuthContext = context
|
98
|
-
last_oauth2_resp: {{ capitalized_service_name }}OAuth2Response = {{ service_name }}_context.detail
|
99
93
|
refresh_token = {{ service_name }}_context.refresh_token
|
100
94
|
|
101
95
|
async with httpx.AsyncClient() as client:
|
102
96
|
resp = await client.post(
|
103
97
|
url=self._{{ upper_service_name }}_TOKEN_URL,
|
104
98
|
data={
|
105
|
-
'client_id':
|
106
|
-
'client_secret':
|
99
|
+
'client_id': auth_req.client_id,
|
100
|
+
'client_secret': auth_req.client_secret,
|
107
101
|
'grant_type': 'refresh_token',
|
108
102
|
'refresh_token': refresh_token,
|
109
103
|
},
|
110
104
|
)
|
111
105
|
|
112
|
-
|
113
|
-
raise Exception(f"failed to refresh. status_code : {resp.status_code}")
|
114
|
-
|
106
|
+
resp.raise_for_status()
|
115
107
|
resp_json = resp.json()
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
**last_oauth2_resp.authed_user.model_dump(),
|
124
|
-
"access_token": resp_json["access_token"],
|
125
|
-
"refresh_token": resp_json["refresh_token"],
|
126
|
-
"expires_in": resp_json["expires_in"],
|
127
|
-
})
|
128
|
-
}
|
129
|
-
)
|
130
|
-
else:
|
131
|
-
new_resp = last_oauth2_resp.model_copy(
|
132
|
-
update={
|
133
|
-
**last_oauth2_resp.model_dump(),
|
134
|
-
"access_token": resp_json["access_token"],
|
135
|
-
"refresh_token": resp_json["refresh_token"],
|
136
|
-
"expires_in": resp_json["expires_in"],
|
137
|
-
}
|
138
|
-
)
|
139
|
-
|
108
|
+
|
109
|
+
new_resp = {{ capitalized_service_name }}OAuth2Response(**{
|
110
|
+
"access_token": resp_json["access_token"],
|
111
|
+
"refresh_token": resp_json["refresh_token"],
|
112
|
+
"expires_in": resp_json["expires_in"],
|
113
|
+
})
|
114
|
+
|
140
115
|
return {{ capitalized_service_name }}OAuth2AuthContext.from_{{ service_name }}_oauth2_response(new_resp)
|
141
116
|
|
142
117
|
def _make_auth_url(self, req: {{ capitalized_service_name }}OAuth2Request, redirect_uri: str, state: str):
|
143
118
|
params = {
|
144
|
-
"
|
119
|
+
"scope": ' '.join(req.auth_scopes),
|
145
120
|
"client_id": req.client_id,
|
146
121
|
"redirect_uri": redirect_uri,
|
147
122
|
"state": state,
|
@@ -152,7 +127,7 @@ class {{ capitalized_service_name }}OAuth2AuthHandler(AuthHandlerInterface):
|
|
152
127
|
def make_request(self, auth_scopes: Optional[list[str]] = None, **kwargs) -> {{ capitalized_service_name }}OAuth2Request:
|
153
128
|
return {{ capitalized_service_name }}OAuth2Request(
|
154
129
|
auth_scopes=auth_scopes,
|
155
|
-
client_id=config.auth.{{ service_name }}.client_id,
|
156
|
-
client_secret=config.auth.{{ service_name }}.client_secret,
|
130
|
+
client_id=config().auth.{{ service_name }}.client_id,
|
131
|
+
client_secret=config().auth.{{ service_name }}.client_secret,
|
157
132
|
)
|
158
|
-
''')
|
133
|
+
''')
|
@@ -1,10 +1,11 @@
|
|
1
1
|
from jinja2 import Template
|
2
2
|
|
3
|
+
|
3
4
|
def get_auth_oauth2_schema_template() -> Template:
|
4
|
-
return Template(
|
5
|
+
return Template("""\
|
5
6
|
from typing import Optional
|
6
7
|
|
7
|
-
from pydantic import BaseModel
|
8
|
+
from pydantic import BaseModel, Field
|
8
9
|
|
9
10
|
from hyperpocket.auth.schema import AuthenticateRequest, AuthenticateResponse
|
10
11
|
|
@@ -17,4 +18,4 @@ class {{ capitalized_service_name }}OAuth2Response(AuthenticateResponse):
|
|
17
18
|
access_token: str
|
18
19
|
expires_in: int
|
19
20
|
refresh_token: Optional[str] = Field(default=None)
|
20
|
-
|
21
|
+
""")
|