Skip to content

Commit

Permalink
fix: Remove _attemptPkamAuth method and invoke pkamAuthenticate in _w…
Browse files Browse the repository at this point in the history
…aitForPkamAuthSuccess
  • Loading branch information
sitaram-kalluri committed Oct 8, 2024
1 parent a612f70 commit cf24f66
Showing 1 changed file with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
try {
// _attemptPkamAuth returns boolean value true when authentication is successful.
// Returns UnAuthenticatedException when authentication fails.
pkamAuthSucceeded =
await _attemptPkamAuth(atLookUp, enrollmentIdFromServer);
pkamAuthSucceeded = await atLookUp.pkamAuthenticate(
enrollmentId: enrollmentIdFromServer);
} on UnAuthenticatedException catch (e) {
// Error codes AT0401 and AT0026 indicate authentication failure due to unapproved enrollment. Retry until the enrollment is approved.
// The variable _pkamAuthSucceeded is false, allowing for PKAM authentication retries.
Expand Down Expand Up @@ -377,23 +377,6 @@ class AtOnboardingServiceImpl implements AtOnboardingService {
}
}

/// Executes PKAM authentication on the secondary server.
///
/// Returns `true` if the authentication is successful.
///
/// Returns UnAuthenticated Exception when authentication fails.
Future<bool> _attemptPkamAuth(AtLookUp atLookUp, String enrollmentId) async {
logger.finer('_attemptPkamAuth: Calling atLookUp.pkamAuthenticate');
// atLookUp.pkamAuthenticate returns true when authentication is successful.
// when authentication fails, returns UnAuthenticatedException.
var pkamResult =
await atLookUp.pkamAuthenticate(enrollmentId: enrollmentId);
logger.finer(
'_attemptPkamAuth: atLookUp.pkamAuthenticate returned $pkamResult');

return pkamResult;
}

///write newly created encryption keypairs into atKeys file
Future<File> _generateAtKeysFile(
at_auth.AtAuthKeys atAuthKeys, {
Expand Down

0 comments on commit cf24f66

Please sign in to comment.