Skip required email verification using post process actions
This chapter will guide you through the steps required to implement skipping email verification on certain scenarios.
What you need?
To successfully complete this topic guide you need to ensure following prerequisites:
- Onegini IDP instance must to be running, for the sake of this guide we assume it's available under http://idp-core.dev.onegini.me address
- Onegini IDP must have the
Username & password
identity provider configured - Onegini IDP must have the
Email verification required
feature configured inConfiguration->Attributes
section
Implementation
In your extension you must implement AuthenticationPostProcessExtension
interface.
This extension point will be called by core when you log in to gather what actions should be done or skipped during application flow.
The response of the AuthenticationPostProcessExtension.determinePostProcessActions()
method should contain a list of PostProcessAction
elements describing required flow modifiers.
For this topic guide we will skip email verification on first login of user. For this we create such class in extension project
@Service
public class SampleAuthenticationPostProcessExtension implements AuthenticationPostProcessExtension {
@Override
public AuthenticationPostProcessResponseDto determinePostProcessActions(final AuthenticationPostProcessRequestDto requestData) {
final AuthenticationPostProcessResponseDto response = new AuthenticationPostProcessResponseDto();
final List<PostProcessAction> actions = new ArrayList<>();
response.setActions(actions);
if (requestData.getPersonActivityStatus().getLoginCount() <= 1) {
actions.add(PostProcessAction.SKIP_REQUIRED_EMAIL_VERIFICATION);
}
return response;
}
}
Testing
Feature can be tested by following below steps:
- On the login screen click register and go thru registration process. At the end you should be logged in and see the dashboard.
- Logout of the application. Try to login in again with credentials used on the registration process. After submiting the login form you should see email not verified page.