8000 [pull] main from microsoft:main by pull[bot] · Pull Request #37 · rrosajp/botbuilder-python · GitHub
[go: up one dir, main page]

Skip to content

[pull] main from microsoft:main #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from microsoft:main
Jan 6, 2025
Merged

[pull] main from microsoft:main #37

merged 1 commit into from
Jan 6, 2025

Conversation

pull[bot]
Copy link
@pull pull bot commented Jan 6, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Bug Fixes:

  • Fix: Handle cases where the access token is not returned, raising a PermissionError instead.

…e_app_credentials (#2196)

Co-authored-by: Konstantin Plis <konstantin.plis@acronis.com>
@pull pull bot added the ⤵️ pull label Jan 6, 2025
@pull pull bot merged commit ef5ecd3 into rrosajp:main Jan 6, 2025
Copy link
sourcery-ai bot commented Jan 6, 2025

Reviewer's Guide by Sourcery

This pull request enhances the get_access_token method within the CertificateAppCredentials class to handle cases where token acquisition fails. It introduces more robust error handling by checking for the presence of an "access_token" in the authentication response and raising a PermissionError with a descriptive message if the token is missing.

Sequence diagram for enhanced token acquisition flow

sequenceDiagram
    participant Client
    participant CertificateAppCredentials
    participant MSAL

    Client->>CertificateAppCredentials: get_access_token()
    CertificateAppCredentials->>MSAL: acquire_token_for_client()
    alt Token acquired successfully
        MSAL-->>CertificateAppCredentials: Return token response with access_token
        CertificateAppCredentials-->>Client: Return access_token
    else Token acquisition failed
        MSAL-->>CertificateAppCredentials: Return error response
        CertificateAppCredentials-->>Client: Throw PermissionError with details
    end
Loading

Class diagram for updated CertificateAppCredentials

classDiagram
    class CertificateAppCredentials {
        -app
        +get_access_token(force_refresh: bool) str
        -__get_msal_app()
    }
    note for CertificateAppCredentials "Enhanced error handling in get_access_token()"
Loading

File-Level Changes

Change Details Files
Improved error handling in get_access_token
  • Added a check for the existence of 'access_token' in the auth_token dictionary before attempting to access it.
  • Included specific error information from the authentication response in the raised PermissionError, providing more context for debugging and troubleshooting failed token acquisitions.
libraries/botframework-connector/botframework/connector/auth/certificate_app_credentials.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0