Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

[PORT] [Authentication] Gov: Support temporary service unavailable results. #507

Closed

Description

Port this change from botbuilder-dotnet/master branch:
microsoft/botbuilder-dotnet#3734

Changed projects

  • Microsoft.Bot.Connector
  • Microsoft.Bot.Connector.Tests

[R9]

Activity

  1. added
    Area: Authentication
    and removed on Aug 14, 2020
  2. added
    needs-triage
    and removed
    needs-triage
    on Jan 13, 2021
  3. tracyboehrer commented on Jan 15, 2021

    @tracyboehrer
    Member

    This needs more research. This has to do with retries to exceptions using Adal in C#. But Java uses MSAL and may (or may not) have the same abilities to provide the same functionality.

  4. tracyboehrer commented on Feb 2, 2021

    @tracyboehrer
    Member

    CredentialsAuthenticator.acquireToken might look something like this:

        public CompletableFuture<IAuthenticationResult> acquireToken() {
            return Retry.run(() -> app.acquireToken(parameters)
                .exceptionally(
                    exception -> {
                        // wrapping whatever msal throws into our own exception
                        throw new AuthenticationException(exception);
                    }
                ),
            (exception, count) -> {
                if (exception instanceof RetryException) {
                    if (exception.getCause() instanceof MsalServiceException) {
                        MsalServiceException serviceException = (MsalServiceException) exception.getCause();
                        if (StringUtils.equals(
                            serviceException.errorCode(),
                            "temporarily_unavailable"
                        )) {
                            List<String> header = serviceException.headers().get("Retry-After");
                            if (header.isEmpty()) {
                                return RetryParams.defaultBackOff(count);
                            }
    
                            // need to parse Retry-After header value for Date or Delta and use
                            // that as the Retry backoff.
                            // For now, retry with default backoff.
                        }
                        return RetryParams.defaultBackOff(count);
                    }
                }
    
                return RetryParams.stopRetrying();
            });
        }
    
  5. changed the title [-][PORT] [Authentication] updates to support Arlington[/-] [+][PORT] [Authentication] Gov: Support temporary service unavailable results.[/+] on Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Authentication

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions