Skip to content

Commit 464e52b

Browse files
committed
Added the validation in SSOCredentials flow also
1 parent 298b10f commit 464e52b

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

auth0/src/main/java/com/auth0/android/authentication/storage/CredentialsManager.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
134134
return@execute
135135
}
136136

137+
val tokenType = storage.retrieveString(KEY_TOKEN_TYPE)
138+
validateDPoPState(tokenType)?.let { dpopError ->
139+
callback.onFailure(dpopError)
140+
return@execute
141+
}
142+
137143
val request = authenticationClient.ssoExchange(refreshToken)
138144
try {
139145
if (parameters.isNotEmpty()) {
@@ -623,7 +629,8 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
623629
return@execute
624630
}
625631

626-
validateDPoPState(apiCredentialType)?.let { dpopError ->
632+
val tokenType = apiCredentialType ?: storage.retrieveString(KEY_TOKEN_TYPE)
633+
validateDPoPState(tokenType)?.let { dpopError ->
627634
callback.onFailure(dpopError)
628635
return@execute
629636
}

auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT
282282
return@execute
283283
}
284284

285+
val tokenType = storage.retrieveString(KEY_TOKEN_TYPE) ?: existingCredentials.type
286+
validateDPoPState(tokenType)?.let { dpopError ->
287+
callback.onFailure(dpopError)
288+
return@execute
289+
}
290+
285291
val request =
286292
authenticationClient.ssoExchange(existingCredentials.refreshToken)
287293
try {
@@ -1021,7 +1027,8 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT
10211027
return@execute
10221028
}
10231029

1024-
validateDPoPState(apiCredentialType)?.let { dpopError ->
1030+
val tokenType = apiCredentialType ?: storage.retrieveString(KEY_TOKEN_TYPE) ?: existingCredentials.type
1031+
validateDPoPState(tokenType)?.let { dpopError ->
10251032
callback.onFailure(dpopError)
10261033
return@execute
10271034
}

0 commit comments

Comments
 (0)