Skip to content

Commit bfadb2c

Browse files
committed
Rename clientBlocked* → appAttestationFailed*; add invalidDpopProof, useDpopNonce
Names now match server-side OauthErrorCode.java (core-264 main): clientBlocked → appAttestationFailed (wire: client_blocked) clientBlockedRetry → appAttestationFailedRetry (wire: client_blocked_retry) Also add two missing distinct wire values from core-264: invalidDpopProof (invalid_dpop_proof) useDpopNonce (use_dpop_nonce)
1 parent 718b403 commit bfadb2c

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/OAuth/SFOAuthErrorCode.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import Foundation
3838
case appNotFound
3939
case authorizationPending
4040
case badJtiClaim
41-
case clientBlocked
42-
case clientBlockedRetry
41+
case appAttestationFailed
42+
case appAttestationFailedRetry
4343
case ecAppPolicyNotFound
4444
case exceededRegistrationLimit
4545
case failCloseAppBlocked
@@ -51,6 +51,7 @@ import Foundation
5151
case invalidBasicAuthHeader
5252
case invalidClient
5353
case invalidClientId
54+
case invalidDpopProof
5455
case invalidDistributionState
5556
case invalidExpid
5657
case invalidGrant
@@ -75,6 +76,7 @@ import Foundation
7576
case unsupportedGrantType
7677
case unsupportedResponseType
7778
case unsupportedTokenType
79+
case useDpopNonce
7880

7981
/// Returns the ``SFOAuthErrorCode`` whose wire value matches `string`,
8082
/// or `.unknown` if `string` is nil, empty, or not recognized.
@@ -105,8 +107,8 @@ public extension SFOAuthErrorCode {
105107
case .appNotFound: return "app_not_found"
106108
case .authorizationPending: return "authorization_pending"
107109
case .badJtiClaim: return "bad_jti_claim"
108-
case .clientBlocked: return "client_blocked"
109-
case .clientBlockedRetry: return "client_blocked_retry"
110+
case .appAttestationFailed: return "client_blocked"
111+
case .appAttestationFailedRetry: return "client_blocked_retry"
110112
case .ecAppPolicyNotFound: return "ecapp_policy_not_found"
111113
case .exceededRegistrationLimit: return "exceeded_registration_limit"
112114
case .failCloseAppBlocked: return "fail_close_app_blocked"
@@ -118,6 +120,7 @@ public extension SFOAuthErrorCode {
118120
case .invalidBasicAuthHeader: return "invalid_basic_auth_header"
119121
case .invalidClient: return "invalid_client"
120122
case .invalidClientId: return "invalid_client_id"
123+
case .invalidDpopProof: return "invalid_dpop_proof"
121124
case .invalidDistributionState: return "invalid_distribution_state"
122125
case .invalidExpid: return "invalid_expid"
123126
case .invalidGrant: return "invalid_grant"
@@ -142,6 +145,7 @@ public extension SFOAuthErrorCode {
142145
case .unsupportedGrantType: return "unsupported_grant_type"
143146
case .unsupportedResponseType: return "unsupported_response_type"
144147
case .unsupportedTokenType: return "unsupported_token_type"
148+
case .useDpopNonce: return "use_dpop_nonce"
145149
@unknown default: return nil
146150
}
147151
}

libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFOAuthErrorCodeTests.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import XCTest
3030

3131
class SFOAuthErrorCodeTests: XCTestCase {
3232

33-
func testFrom_knownClientBlockedValue_returnsClientBlocked() {
34-
XCTAssertEqual(SFOAuthErrorCode.from("client_blocked"), .clientBlocked)
33+
func testFrom_knownClientBlockedValue_returnsAppAttestationFailed() {
34+
XCTAssertEqual(SFOAuthErrorCode.from("client_blocked"), .appAttestationFailed)
3535
}
3636

3737
func testFrom_knownUnsupportedGrantType_returnsUnsupportedGrantType() {
@@ -50,6 +50,14 @@ class SFOAuthErrorCodeTests: XCTestCase {
5050
XCTAssertEqual(SFOAuthErrorCode.from(""), .unknown)
5151
}
5252

53+
func testFrom_invalidDpopProof_returnsInvalidDpopProof() {
54+
XCTAssertEqual(SFOAuthErrorCode.from("invalid_dpop_proof"), .invalidDpopProof)
55+
}
56+
57+
func testFrom_useDpopNonce_returnsUseDpopNonce() {
58+
XCTAssertEqual(SFOAuthErrorCode.from("use_dpop_nonce"), .useDpopNonce)
59+
}
60+
5361
func testFrom_allKnownValues_roundTrip() {
5462
let knownCases = SFOAuthErrorCode.allCases.filter { $0 != .unknown }
5563
for code in knownCases {

0 commit comments

Comments
 (0)