This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/enable okta push notification (#273)
* feat(websecurity): Enables push notifications for the Okta Verify factor.
- Loading branch information
1 parent
7005409
commit 2dd96b1
Showing
26 changed files
with
2,804 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...a/src/main/java/com/nike/cerberus/auth/connector/okta/statehandlers/PushStateHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.nike.cerberus.auth.connector.okta.statehandlers; | ||
|
||
import com.nike.cerberus.auth.connector.AuthData; | ||
import com.nike.cerberus.auth.connector.AuthResponse; | ||
import com.nike.cerberus.auth.connector.AuthStatus; | ||
import com.okta.authn.sdk.client.AuthenticationClient; | ||
import com.okta.authn.sdk.resource.AuthenticationResponse; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class PushStateHandler extends AbstractOktaStateHandler { | ||
public PushStateHandler( | ||
AuthenticationClient client, CompletableFuture<AuthResponse> authenticationResponseFuture) { | ||
super(client, authenticationResponseFuture); | ||
} | ||
|
||
/** | ||
* Handles MFA Challenge, when a MFA challenge has been initiated for call or sms. | ||
* | ||
* @param mfaChallengeResponse - Authentication response from the Completable Future | ||
*/ | ||
@Override | ||
public void handleMfaChallenge(AuthenticationResponse mfaChallengeResponse) { | ||
|
||
final String userId = mfaChallengeResponse.getUser().getId(); | ||
final String userLogin = mfaChallengeResponse.getUser().getLogin(); | ||
final String factorResult = mfaChallengeResponse.getFactorResult(); | ||
|
||
final AuthData authData = | ||
new AuthData().setUserId(userId).setUsername(userLogin).setFactorResult(factorResult); | ||
AuthResponse authResponse = | ||
new AuthResponse().setData(authData).setStatus(AuthStatus.MFA_CHALLENGE); | ||
|
||
authenticationResponseFuture.complete(authResponse); | ||
} | ||
|
||
/** | ||
* Handles MFA Challenge, when a MFA challenge has been initiated for call or sms. | ||
* | ||
* @param mfaChallengeResponse - Authentication response from the Completable Future | ||
*/ | ||
@Override | ||
public void handleSuccess(AuthenticationResponse mfaChallengeResponse) { | ||
|
||
final String userId = mfaChallengeResponse.getUser().getId(); | ||
final String userLogin = mfaChallengeResponse.getUser().getLogin(); | ||
final String factorResult = mfaChallengeResponse.getStatus().toString(); | ||
|
||
final AuthData authData = | ||
new AuthData().setUserId(userId).setUsername(userLogin).setFactorResult(factorResult); | ||
AuthResponse authResponse = new AuthResponse().setData(authData).setStatus(AuthStatus.SUCCESS); | ||
|
||
authenticationResponseFuture.complete(authResponse); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.