From 9aaaea5d1ffe7dcb2dc7b797d10d687800c63f7a Mon Sep 17 00:00:00 2001 From: Luciano Balmaceda Date: Mon, 11 Jan 2021 15:11:00 +0100 Subject: [PATCH] update method name to fit log out and log in --- .../android/authentication/AuthenticationException.kt | 4 ++++ .../authentication/AuthenticationExceptionTest.kt | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt b/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt index e6aa6e906..2a68425f2 100644 --- a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt +++ b/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt @@ -143,7 +143,11 @@ public class AuthenticationException : Auth0Exception { get() = "a0.invalid_configuration" == code // When a user closes the browser app and in turn, cancels the authentication + @Deprecated("This property can refer to both log in and log out actions.", replaceWith = ReplaceWith("isCanceled")) public val isAuthenticationCanceled: Boolean + get() = isCanceled + + public val isCanceled: Boolean get() = "a0.authentication_canceled" == code /// When MFA code is required to authenticate diff --git a/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt b/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt index 5fe2324b3..7110e9c4f 100644 --- a/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt +++ b/auth0/src/test/java/com/auth0/android/authentication/AuthenticationExceptionTest.kt @@ -408,6 +408,15 @@ public class AuthenticationExceptionTest { MatcherAssert.assertThat(ex.isAuthenticationCanceled, CoreMatchers.`is`(true)) } + @Test + public fun shouldHaveCanceled() { + values[CODE_KEY] = "a0.authentication_canceled" + val ex = AuthenticationException( + values + ) + MatcherAssert.assertThat(ex.isCanceled, CoreMatchers.`is`(true)) + } + @Test public fun shouldHavePasswordLeaked() { values[CODE_KEY] = "password_leaked"