propelauth-fastapi 4.2.6__tar.gz → 4.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/PKG-INFO +1 -1
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi/__init__.py +387 -2
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi.egg-info/PKG-INFO +1 -1
- propelauth-fastapi-4.2.7/propelauth_fastapi.egg-info/requires.txt +3 -0
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/setup.py +2 -2
- propelauth-fastapi-4.2.6/propelauth_fastapi.egg-info/requires.txt +0 -2
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/LICENSE +0 -0
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/README.md +0 -0
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi.egg-info/SOURCES.txt +0 -0
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi.egg-info/dependency_links.txt +0 -0
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi.egg-info/top_level.txt +0 -0
- {propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/setup.cfg +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import httpx
|
|
1
2
|
from typing import Any, Dict, List, Optional
|
|
2
|
-
|
|
3
3
|
from fastapi import Depends, HTTPException, Header
|
|
4
4
|
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
|
|
5
5
|
from propelauth_py import (
|
|
6
6
|
TokenVerificationMetadata,
|
|
7
7
|
init_base_auth,
|
|
8
|
-
|
|
8
|
+
init_base_async_auth,
|
|
9
9
|
SamlIdpMetadata,
|
|
10
10
|
StepUpMfaGrantType,
|
|
11
11
|
StepUpMfaVerifyTotpResponse,
|
|
@@ -453,6 +453,381 @@ class FastAPIAuth:
|
|
|
453
453
|
|
|
454
454
|
def verify_step_up_grant(self, action_type: str, user_id: str, grant: str) -> bool:
|
|
455
455
|
return self.auth.verify_step_up_grant(action_type, user_id, grant)
|
|
456
|
+
|
|
457
|
+
class FastAPIAuthAsync():
|
|
458
|
+
def __init__(
|
|
459
|
+
self,
|
|
460
|
+
auth_url: str,
|
|
461
|
+
integration_api_key: str,
|
|
462
|
+
token_verification_metadata: Optional[TokenVerificationMetadata],
|
|
463
|
+
debug_mode: bool,
|
|
464
|
+
httpx_client: Optional[httpx.AsyncClient] = None,
|
|
465
|
+
):
|
|
466
|
+
self.auth_url = auth_url
|
|
467
|
+
self.integration_api_key = integration_api_key
|
|
468
|
+
self.token_verification_metadata = token_verification_metadata
|
|
469
|
+
self.debug_mode = debug_mode
|
|
470
|
+
self.httpx_client = httpx_client
|
|
471
|
+
self.auth = init_base_async_auth(auth_url, integration_api_key, token_verification_metadata, self.httpx_client)
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def require_user(self, credentials: HTTPAuthorizationCredentials = Depends(_security)):
|
|
475
|
+
try:
|
|
476
|
+
# Pass it in to the underlying function to get consistent error messages
|
|
477
|
+
if credentials is None:
|
|
478
|
+
authorization_header = ""
|
|
479
|
+
else:
|
|
480
|
+
authorization_header = (
|
|
481
|
+
credentials.scheme + " " + credentials.credentials
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
user = self.auth.validate_access_token_and_get_user(authorization_header)
|
|
485
|
+
return user
|
|
486
|
+
except UnauthorizedException as e:
|
|
487
|
+
if self.debug_mode:
|
|
488
|
+
raise HTTPException(status_code=401, detail=e.message)
|
|
489
|
+
else:
|
|
490
|
+
raise HTTPException(status_code=401)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
def optional_user(self, credentials: HTTPAuthorizationCredentials = Depends(_security)):
|
|
494
|
+
if credentials is None:
|
|
495
|
+
return None
|
|
496
|
+
|
|
497
|
+
try:
|
|
498
|
+
authorization_header = credentials.scheme + " " + credentials.credentials
|
|
499
|
+
user = self.auth.validate_access_token_and_get_user(authorization_header)
|
|
500
|
+
return user
|
|
501
|
+
except UnauthorizedException:
|
|
502
|
+
return None
|
|
503
|
+
|
|
504
|
+
def require_org_member(self, user: User, required_org_id: str):
|
|
505
|
+
try:
|
|
506
|
+
return self.auth.validate_org_access_and_get_org(user, required_org_id)
|
|
507
|
+
except ForbiddenException as e:
|
|
508
|
+
_handle_forbidden_exception(e, self.debug_mode)
|
|
509
|
+
|
|
510
|
+
def require_org_member_with_minimum_role(self, user: User, required_org_id: str, minimum_required_role: str):
|
|
511
|
+
try:
|
|
512
|
+
return self.auth.validate_minimum_org_role_and_get_org(
|
|
513
|
+
user, required_org_id, minimum_required_role
|
|
514
|
+
)
|
|
515
|
+
except ForbiddenException as e:
|
|
516
|
+
_handle_forbidden_exception(e, self.debug_mode)
|
|
517
|
+
|
|
518
|
+
def require_org_member_with_exact_role(self, user: User, required_org_id: str, role: str):
|
|
519
|
+
try:
|
|
520
|
+
return self.auth.validate_exact_org_role_and_get_org(user, required_org_id, role)
|
|
521
|
+
except ForbiddenException as e:
|
|
522
|
+
_handle_forbidden_exception(e, self.debug_mode)
|
|
523
|
+
|
|
524
|
+
def require_org_member_with_permission(self, user: User, required_org_id: str, permission: str):
|
|
525
|
+
try:
|
|
526
|
+
return self.auth.validate_permission_and_get_org(
|
|
527
|
+
user, required_org_id, permission
|
|
528
|
+
)
|
|
529
|
+
except ForbiddenException as e:
|
|
530
|
+
_handle_forbidden_exception(e, self.debug_mode)
|
|
531
|
+
|
|
532
|
+
def require_org_member_with_all_permissions(self, user: User, required_org_id: str, permissions: List[str]):
|
|
533
|
+
try:
|
|
534
|
+
return self.auth.validate_all_permissions_and_get_org(
|
|
535
|
+
user, required_org_id, permissions
|
|
536
|
+
)
|
|
537
|
+
except ForbiddenException as e:
|
|
538
|
+
_handle_forbidden_exception(e, self.debug_mode)
|
|
539
|
+
|
|
540
|
+
def validate_access_token_and_get_user(self, authorization_header: str) -> User:
|
|
541
|
+
return self.auth.validate_access_token_and_get_user(authorization_header=authorization_header)
|
|
542
|
+
|
|
543
|
+
async def fetch_user_metadata_by_user_id(self, user_id: str, include_orgs: bool = False):
|
|
544
|
+
return await self.auth.fetch_user_metadata_by_user_id(user_id, include_orgs)
|
|
545
|
+
|
|
546
|
+
async def fetch_user_metadata_by_email(self, email: str, include_orgs: bool = False):
|
|
547
|
+
return await self.auth.fetch_user_metadata_by_email(email, include_orgs)
|
|
548
|
+
|
|
549
|
+
async def fetch_user_metadata_by_username(self, username: str, include_orgs: bool = False):
|
|
550
|
+
return await self.auth.fetch_user_metadata_by_username(username, include_orgs)
|
|
551
|
+
|
|
552
|
+
async def fetch_user_signup_query_params_by_user_id(self, user_id: str):
|
|
553
|
+
return await self.auth.fetch_user_signup_query_params_by_user_id(user_id)
|
|
554
|
+
|
|
555
|
+
async def fetch_batch_user_metadata_by_user_ids(self, user_ids: List[str], include_orgs: bool = False):
|
|
556
|
+
return await self.auth.fetch_batch_user_metadata_by_user_ids(user_ids, include_orgs)
|
|
557
|
+
|
|
558
|
+
async def fetch_batch_user_metadata_by_emails(self, emails: List[str], include_orgs: bool = False):
|
|
559
|
+
return await self.auth.fetch_batch_user_metadata_by_emails(emails, include_orgs)
|
|
560
|
+
|
|
561
|
+
async def fetch_batch_user_metadata_by_usernames(self, usernames: List[str], include_orgs: bool = False):
|
|
562
|
+
return await self.auth.fetch_batch_user_metadata_by_usernames(usernames, include_orgs)
|
|
563
|
+
|
|
564
|
+
async def fetch_org(self, org_id: str):
|
|
565
|
+
return await self.auth.fetch_org(org_id)
|
|
566
|
+
|
|
567
|
+
async def fetch_org_by_query(
|
|
568
|
+
self, page_size: int = 10, page_number: int = 0, order_by: OrgQueryOrderBy = OrgQueryOrderBy.CREATED_AT_ASC,
|
|
569
|
+
name: Optional[str] = None, legacy_org_id: Optional[str] = None, domain: Optional[str] = None
|
|
570
|
+
):
|
|
571
|
+
return await self.auth.fetch_org_by_query(page_size, page_number, order_by, name, legacy_org_id, domain)
|
|
572
|
+
|
|
573
|
+
async def fetch_custom_role_mappings(self):
|
|
574
|
+
return await self.auth.fetch_custom_role_mappings()
|
|
575
|
+
|
|
576
|
+
async def fetch_pending_invites(self, page_number: int = 0, page_size: int = 10, org_id: Optional[str] = None):
|
|
577
|
+
return await self.auth.fetch_pending_invites(page_number, page_size, org_id)
|
|
578
|
+
|
|
579
|
+
async def fetch_users_by_query(
|
|
580
|
+
self, page_size: int = 10, page_number: int = 0, order_by: UserQueryOrderBy = UserQueryOrderBy.CREATED_AT_ASC,
|
|
581
|
+
email_or_username: Optional[str] = None, include_orgs: bool = False, legacy_user_id: Optional[str] = None
|
|
582
|
+
):
|
|
583
|
+
return await self.auth.fetch_users_by_query(page_size, page_number, order_by, email_or_username, include_orgs, legacy_user_id)
|
|
584
|
+
|
|
585
|
+
async def fetch_users_in_org(
|
|
586
|
+
self, org_id: str, page_size: int = 10, page_number: int = 0, include_orgs: bool = False, role: Optional[str] = None
|
|
587
|
+
):
|
|
588
|
+
return await self.auth.fetch_users_in_org(org_id, page_size, page_number, include_orgs, role)
|
|
589
|
+
|
|
590
|
+
async def create_user(
|
|
591
|
+
self, email: str, email_confirmed: bool = False, send_email_to_confirm_email_address: bool = True,
|
|
592
|
+
ask_user_to_update_password_on_login: bool = False, password: Optional[str] = None, username: Optional[str] = None,
|
|
593
|
+
first_name: Optional[str] = None, last_name: Optional[str] = None, properties: Optional[Dict[str, Any]] = None, ignore_domain_restrictions: bool = False
|
|
594
|
+
):
|
|
595
|
+
return await self.auth.create_user(
|
|
596
|
+
email, email_confirmed, send_email_to_confirm_email_address, ask_user_to_update_password_on_login,
|
|
597
|
+
password, username, first_name, last_name, properties, ignore_domain_restrictions
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
async def invite_user_to_org(self, email: str, org_id: str, role: str, additional_roles: List[str] = []):
|
|
601
|
+
return await self.auth.invite_user_to_org(email, org_id, role, additional_roles)
|
|
602
|
+
|
|
603
|
+
async def resend_email_confirmation(self, user_id: str):
|
|
604
|
+
return await self.auth.resend_email_confirmation(user_id)
|
|
605
|
+
|
|
606
|
+
async def logout_all_user_sessions(self, user_id: str):
|
|
607
|
+
return await self.auth.logout_all_user_sessions(user_id)
|
|
608
|
+
|
|
609
|
+
async def update_user_email(self, user_id: str, new_email: str, require_email_confirmation: bool):
|
|
610
|
+
return await self.auth.update_user_email(user_id, new_email, require_email_confirmation)
|
|
611
|
+
|
|
612
|
+
async def update_user_metadata(
|
|
613
|
+
self,
|
|
614
|
+
user_id: str,
|
|
615
|
+
username: Optional[str] = None,
|
|
616
|
+
first_name: Optional[str] = None,
|
|
617
|
+
last_name: Optional[str] = None,
|
|
618
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
619
|
+
properties: Optional[Dict[str, Any]] = None,
|
|
620
|
+
picture_url: Optional[str] = None,
|
|
621
|
+
update_password_required: Optional[bool] = None,
|
|
622
|
+
legacy_user_id: Optional[str] = None,
|
|
623
|
+
):
|
|
624
|
+
return await self.auth.update_user_metadata(
|
|
625
|
+
user_id, username, first_name, last_name, metadata, properties, picture_url, update_password_required, legacy_user_id
|
|
626
|
+
)
|
|
627
|
+
|
|
628
|
+
async def clear_user_password(self, user_id: str):
|
|
629
|
+
return await self.auth.clear_user_password(user_id)
|
|
630
|
+
|
|
631
|
+
async def update_user_password(self, user_id: str, password: str, ask_user_to_update_password_on_login: bool = False):
|
|
632
|
+
return await self.auth.update_user_password(user_id, password, ask_user_to_update_password_on_login)
|
|
633
|
+
|
|
634
|
+
async def create_magic_link(
|
|
635
|
+
self,
|
|
636
|
+
email: str,
|
|
637
|
+
redirect_to_url: Optional[str] = None,
|
|
638
|
+
expires_in_hours: Optional[str] = None,
|
|
639
|
+
create_new_user_if_one_doesnt_exist: Optional[bool] = None,
|
|
640
|
+
user_signup_query_parameters: Optional[Dict[str, Any]] = None,
|
|
641
|
+
):
|
|
642
|
+
return await self.auth.create_magic_link(
|
|
643
|
+
email, redirect_to_url, expires_in_hours, create_new_user_if_one_doesnt_exist, user_signup_query_parameters
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
async def create_access_token(self, user_id: str, duration_in_minutes: int, active_org_id: Optional[str] = None):
|
|
647
|
+
return await self.auth.create_access_token(user_id, duration_in_minutes, active_org_id)
|
|
648
|
+
|
|
649
|
+
async def migrate_user_from_external_source(
|
|
650
|
+
self,
|
|
651
|
+
email: str,
|
|
652
|
+
email_confirmed: bool,
|
|
653
|
+
existing_user_id: Optional[str] = None,
|
|
654
|
+
existing_password_hash: Optional[str] = None,
|
|
655
|
+
existing_mfa_base32_encoded_secret: Optional[str] = None,
|
|
656
|
+
ask_user_to_update_password_on_login: bool = False,
|
|
657
|
+
enabled: Optional[bool] = None,
|
|
658
|
+
first_name: Optional[str] = None,
|
|
659
|
+
last_name: Optional[str] = None,
|
|
660
|
+
username: Optional[str] = None,
|
|
661
|
+
picture_url: Optional[str] = None,
|
|
662
|
+
properties: Optional[Dict[str, Any]] = None,
|
|
663
|
+
):
|
|
664
|
+
return await self.auth.migrate_user_from_external_source(
|
|
665
|
+
email, email_confirmed, existing_user_id, existing_password_hash,
|
|
666
|
+
existing_mfa_base32_encoded_secret, ask_user_to_update_password_on_login,
|
|
667
|
+
enabled, first_name, last_name, username, picture_url, properties
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
async def migrate_user_password(
|
|
671
|
+
self,
|
|
672
|
+
user_id: str,
|
|
673
|
+
password_hash: str,
|
|
674
|
+
):
|
|
675
|
+
return await self.auth.migrate_user_password(user_id, password_hash)
|
|
676
|
+
|
|
677
|
+
async def create_org(
|
|
678
|
+
self,
|
|
679
|
+
name: str,
|
|
680
|
+
enable_auto_joining_by_domain: bool = False,
|
|
681
|
+
members_must_have_matching_domain: bool = False,
|
|
682
|
+
domain: Optional[str] = None,
|
|
683
|
+
max_users: Optional[str] = None,
|
|
684
|
+
custom_role_mapping_name: Optional[str] = None,
|
|
685
|
+
legacy_org_id: Optional[str] = None,
|
|
686
|
+
):
|
|
687
|
+
return await self.auth.create_org(
|
|
688
|
+
name, enable_auto_joining_by_domain, members_must_have_matching_domain,
|
|
689
|
+
domain, max_users, custom_role_mapping_name, legacy_org_id
|
|
690
|
+
)
|
|
691
|
+
|
|
692
|
+
async def update_org_metadata(
|
|
693
|
+
self,
|
|
694
|
+
org_id: str,
|
|
695
|
+
name: Optional[str] = None,
|
|
696
|
+
can_setup_saml: Optional[bool] = None,
|
|
697
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
698
|
+
max_users: Optional[str] = None,
|
|
699
|
+
can_join_on_email_domain_match: Optional[bool] = None,
|
|
700
|
+
members_must_have_email_domain_match: Optional[bool] = None,
|
|
701
|
+
domain: Optional[str] = None,
|
|
702
|
+
require_2fa_by: Optional[str] = None,
|
|
703
|
+
extra_domains: Optional[List[str]] = None,
|
|
704
|
+
):
|
|
705
|
+
return await self.auth.update_org_metadata(
|
|
706
|
+
org_id, name, can_setup_saml, metadata, max_users,
|
|
707
|
+
can_join_on_email_domain_match, members_must_have_email_domain_match, domain, require_2fa_by, extra_domains
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
async def subscribe_org_to_role_mapping(self, org_id: str, custom_role_mapping_name: str):
|
|
711
|
+
return await self.auth.subscribe_org_to_role_mapping(org_id, custom_role_mapping_name)
|
|
712
|
+
|
|
713
|
+
async def delete_org(self, org_id: str):
|
|
714
|
+
return await self.auth.delete_org(org_id)
|
|
715
|
+
|
|
716
|
+
async def revoke_pending_org_invite(self, org_id: str, invitee_email: str):
|
|
717
|
+
return await self.auth.revoke_pending_org_invite(org_id, invitee_email)
|
|
718
|
+
|
|
719
|
+
async def add_user_to_org(self, user_id: str, org_id: str, role: str, additional_roles: List[str] = []):
|
|
720
|
+
return await self.auth.add_user_to_org(user_id, org_id, role, additional_roles)
|
|
721
|
+
|
|
722
|
+
async def remove_user_from_org(self, user_id: str, org_id: str):
|
|
723
|
+
return await self.auth.remove_user_from_org(user_id, org_id)
|
|
724
|
+
|
|
725
|
+
async def change_user_role_in_org(self, user_id: str, org_id: str, role: str, additional_roles: List[str] = []):
|
|
726
|
+
return await self.auth.change_user_role_in_org(user_id, org_id, role, additional_roles)
|
|
727
|
+
|
|
728
|
+
async def delete_user(self, user_id: str):
|
|
729
|
+
return await self.auth.delete_user(user_id)
|
|
730
|
+
|
|
731
|
+
async def disable_user(self, user_id: str):
|
|
732
|
+
return await self.auth.disable_user(user_id)
|
|
733
|
+
|
|
734
|
+
async def enable_user(self, user_id: str):
|
|
735
|
+
return await self.auth.enable_user(user_id)
|
|
736
|
+
|
|
737
|
+
async def disable_user_2fa(self, user_id: str):
|
|
738
|
+
return await self.auth.disable_user_2fa(user_id)
|
|
739
|
+
|
|
740
|
+
async def enable_user_can_create_orgs(self, user_id: str):
|
|
741
|
+
return await self.auth.enable_user_can_create_orgs(user_id)
|
|
742
|
+
|
|
743
|
+
async def disable_user_can_create_orgs(self, user_id: str):
|
|
744
|
+
return await self.auth.disable_user_can_create_orgs(user_id)
|
|
745
|
+
|
|
746
|
+
async def allow_org_to_setup_saml_connection(self, org_id: str):
|
|
747
|
+
return await self.auth.allow_org_to_setup_saml_connection(org_id)
|
|
748
|
+
|
|
749
|
+
async def disallow_org_to_setup_saml_connection(self, org_id: str):
|
|
750
|
+
return await self.auth.disallow_org_to_setup_saml_connection(org_id)
|
|
751
|
+
|
|
752
|
+
async def fetch_api_key(self, api_key_id: str):
|
|
753
|
+
return await self.auth.fetch_api_key(api_key_id)
|
|
754
|
+
|
|
755
|
+
async def fetch_current_api_keys(
|
|
756
|
+
self,
|
|
757
|
+
org_id: Optional[str] = None,
|
|
758
|
+
user_id: Optional[str] = None,
|
|
759
|
+
user_email: Optional[str] = None,
|
|
760
|
+
page_size: Optional[int] = None,
|
|
761
|
+
page_number: Optional[int] = None,
|
|
762
|
+
api_key_type: Optional[str] = None,
|
|
763
|
+
):
|
|
764
|
+
return await self.auth.fetch_current_api_keys(
|
|
765
|
+
org_id, user_id, user_email, page_size, page_number, api_key_type
|
|
766
|
+
)
|
|
767
|
+
|
|
768
|
+
async def fetch_archived_api_keys(
|
|
769
|
+
self,
|
|
770
|
+
org_id: Optional[str] = None,
|
|
771
|
+
user_id: Optional[str] = None,
|
|
772
|
+
user_email: Optional[str] = None,
|
|
773
|
+
page_size: Optional[int] = None,
|
|
774
|
+
page_number: Optional[int] = None,
|
|
775
|
+
api_key_type: Optional[str] = None,
|
|
776
|
+
):
|
|
777
|
+
return await self.auth.fetch_archived_api_keys(
|
|
778
|
+
org_id, user_id, user_email, page_size, page_number, api_key_type
|
|
779
|
+
)
|
|
780
|
+
|
|
781
|
+
async def create_api_key(
|
|
782
|
+
self,
|
|
783
|
+
org_id: Optional[str] = None,
|
|
784
|
+
user_id: Optional[str] = None,
|
|
785
|
+
expires_at_seconds: Optional[str] = None,
|
|
786
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
787
|
+
):
|
|
788
|
+
return await self.auth.create_api_key(org_id, user_id, expires_at_seconds, metadata)
|
|
789
|
+
|
|
790
|
+
async def update_api_key(self, api_key_id: str, expires_at_seconds: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None):
|
|
791
|
+
return await self.auth.update_api_key(api_key_id, expires_at_seconds, metadata)
|
|
792
|
+
|
|
793
|
+
async def delete_api_key(self, api_key_id: str):
|
|
794
|
+
return await self.auth.delete_api_key(api_key_id)
|
|
795
|
+
|
|
796
|
+
async def validate_personal_api_key(self, api_key_token: str):
|
|
797
|
+
return await self.auth.validate_personal_api_key(api_key_token)
|
|
798
|
+
|
|
799
|
+
async def validate_org_api_key(self, api_key_token: str):
|
|
800
|
+
return await self.auth.validate_org_api_key(api_key_token)
|
|
801
|
+
|
|
802
|
+
async def validate_api_key(self, api_key_token: str):
|
|
803
|
+
return await self.auth.validate_api_key(api_key_token)
|
|
804
|
+
|
|
805
|
+
async def fetch_saml_sp_metadata(self, org_id: str):
|
|
806
|
+
return await self.auth.fetch_saml_sp_metadata(org_id)
|
|
807
|
+
|
|
808
|
+
async def set_saml_idp_metadata(self, org_id: str, saml_idp_metadata: SamlIdpMetadata):
|
|
809
|
+
return await self.auth.set_saml_idp_metadata(org_id=org_id, saml_idp_metadata=saml_idp_metadata)
|
|
810
|
+
|
|
811
|
+
async def saml_go_live(self, org_id: str):
|
|
812
|
+
return await self.auth.saml_go_live(org_id)
|
|
813
|
+
|
|
814
|
+
async def delete_saml_connection(self, org_id: str):
|
|
815
|
+
return await self.auth.delete_saml_connection(org_id)
|
|
816
|
+
|
|
817
|
+
async def verify_step_up_totp_challenge(
|
|
818
|
+
self,
|
|
819
|
+
action_type: str,
|
|
820
|
+
user_id: str,
|
|
821
|
+
code: str,
|
|
822
|
+
grant_type: StepUpMfaGrantType,
|
|
823
|
+
valid_for_seconds: int,
|
|
824
|
+
) -> StepUpMfaVerifyTotpResponse:
|
|
825
|
+
return await self.auth.verify_step_up_totp_challenge(
|
|
826
|
+
action_type, user_id, code, grant_type, valid_for_seconds
|
|
827
|
+
)
|
|
828
|
+
|
|
829
|
+
async def verify_step_up_grant(self, action_type: str, user_id: str, grant: str) -> bool:
|
|
830
|
+
return await self.auth.verify_step_up_grant(action_type, user_id, grant)
|
|
456
831
|
|
|
457
832
|
def init_auth(
|
|
458
833
|
auth_url: str,
|
|
@@ -462,4 +837,14 @@ def init_auth(
|
|
|
462
837
|
) -> FastAPIAuth:
|
|
463
838
|
"""Fetches metadata required to validate access tokens and returns auth decorators and utilities"""
|
|
464
839
|
return FastAPIAuth(auth_url=auth_url, integration_api_key=api_key, token_verification_metadata=token_verification_metadata, debug_mode=debug_mode)
|
|
840
|
+
|
|
841
|
+
def init_auth_async(
|
|
842
|
+
auth_url: str,
|
|
843
|
+
api_key: str,
|
|
844
|
+
token_verification_metadata: Optional[TokenVerificationMetadata] = None,
|
|
845
|
+
debug_mode=False,
|
|
846
|
+
httpx_client: Optional[httpx.AsyncClient] = None,
|
|
847
|
+
) -> FastAPIAuthAsync:
|
|
848
|
+
"""Fetches metadata required to validate access tokens and returns auth decorators and utilities"""
|
|
849
|
+
return FastAPIAuthAsync(auth_url=auth_url, integration_api_key=api_key, token_verification_metadata=token_verification_metadata, debug_mode=debug_mode, httpx_client=httpx_client)
|
|
465
850
|
|
|
@@ -12,7 +12,7 @@ pytest_runner = ["pytest-runner"] if needs_pytest else []
|
|
|
12
12
|
|
|
13
13
|
setup(
|
|
14
14
|
name="propelauth-fastapi",
|
|
15
|
-
version="4.2.
|
|
15
|
+
version="4.2.7",
|
|
16
16
|
description="A FastAPI library for managing authentication, backed by PropelAuth",
|
|
17
17
|
long_description=README,
|
|
18
18
|
long_description_content_type="text/markdown",
|
|
@@ -21,7 +21,7 @@ setup(
|
|
|
21
21
|
author="PropelAuth",
|
|
22
22
|
author_email="support@propelauth.com",
|
|
23
23
|
license="MIT",
|
|
24
|
-
install_requires=["propelauth-py==4.2.
|
|
24
|
+
install_requires=["propelauth-py==4.2.7", "requests", "httpx>=0.28.1"],
|
|
25
25
|
setup_requires=pytest_runner,
|
|
26
26
|
tests_require=["pytest==4.4.1"],
|
|
27
27
|
test_suite="tests",
|
|
File without changes
|
|
File without changes
|
{propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{propelauth-fastapi-4.2.6 → propelauth-fastapi-4.2.7}/propelauth_fastapi.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|