19 CEO Dashboard Examples for Business Leaders
Let's rewind to the 1990s. Data used to be stored on servers and CEOs relied on basic tools to make optimal decisions. No dashboards, nothing. When you use Power BI with a solid...
Kapil Panchal - October 31, 2023
Listening is fun too.
Straighten your back and cherish with coffee - PLAY !
KeyCloak is an open-source identity and access management (IAM) solution for modern Java application development services. It enables developers to easily add authentication and authorization to their applications while providing robust security features such as multi-factor authentication, role-based access control, and fine-grained authorization policies. KeyCloak also offers a range of customization options, including the ability to customize required actions.
In this blog, we will explore the significance of KeyCloak validation and how it can help you in securing your business application.
Required actions are a set of actions (a kind of validation) that users must complete to access certain resources or features of an application. These actions include setting up two-factor authentication, confirming an email address, or updating a password.
What's interesting about KeyCloak is that it offers several built-in required actions. It also allows experts to create custom-required actions that fit your application's specific needs.
Customization is like making things work in your way be it an app or a software. It allows you to set up security measures as per your needs and creates a barrier to external threats. Tailor-made solutions play a critical role in enhancing business security and acquiring client trust.
Here's how it works: when you use a service or a platform (like KeyCloak), you can customize it according to your security requirements. It's not a one-size-fits-all solution.
Customization gives you control. It allows you to decide the right access for your business data and set limitations. You do not need to be stuck with default settings. It's like your playground with your set of rules. It's your world, and you're in charge.
More importantly, customization strengthens your defenses by making it harder for anyone with ill intentions to break in.
Whether you're a seasoned software expert, a diligent business professional, or a newbie, remember this: customization will be your ally in enhancing digital security.
To create a custom required action in KeyCloak, you'll need to follow these steps:
The first step is to create a Java Archive (JAR) file containing the required action code. This code will define the behaviour of the required action, including what happens when a user completes it and what data is collected during the process.
1. RequiredActionFactory
2. RequiredActionProvider
The RequiredActionFactory interface is responsible for creating the Instance of the RequiredActionProvider.
@Override public RequiredActionProvider create(KeycloakSession session) { return new CustomRequiredActionProvider(); } @Override public String getId() { return “Custom_Action”; } @Override public String getDisplayText() { return "Secret Question"; }
We need to implement these methods from RequiredActionFactory in our CustomFactory.
The create method is used to return the instance of our RequiredActionProvider.
The getId method is used to set the id of our custom required action provider for keycloak to access it.
The getDisplayText method is used to show a familiar name in the admin console.
After implementing RequiredActionFactory, we will implement RequiredActionProvider interface.
@Override public void requiredActionChallenge(RequiredActionContext context) { Response challenge = context.form().createForm("secret_question_config.ftl"); context.challenge(challenge); }
The first method to implement is requiredActionChallenge method. This method is the initial call by the flow manager. It is responsible for rendering the HTML page required for initiating the required action.
In this method, the form method of RequiredActionContext class returns an instance of FreeMarkerLoginFormsProvider (implementing class of LoginFormsProvider). The createForm method of FreeMarkerLoginFormsProvider is used for rendering the HTML form.
createForm method takes a string as an argument which needs to be the name of the 'FTL' file.
The challenge method of RequiredActionContext class notifies the flow manager that a required action must be executed.
@Override public void processAction(RequiredActionContext context) { MultivaluedMapformData = context.getHttpRequest().getDecodedFormParameters(); //Business Logic context.success(); }
The next method to implement is processAction. This method is called to process the input from the HTML form. The action URL of the form will route to processAction method.
The form data is received from context.getHttpRequest().getDecodedFormParameters() method.
After completing the business logic context.success() notifies the flow manager that the required action was successful.
You will package your classes within a single jar. This jar does not have to be separate from other provider classes but it must contain a file named org.keycloak.authentication.RequiredActionFactory and must be contained in the META-INF/services/ directory of your jar. This file must list the fully qualified class name of each RequiredActionFactory implementation you have in the jar.
For example:
org.keycloak.examples.authenticator.SecretQuestionRequiredActionFactory
This service (or file) is used by Keycloak to scan the providers it has to load into the system.
Once you have the JAR file, you'll need to deploy it to the KeyCloak server. This can be done by copying the file directly to the server's deployment directory i.e., the providers/ directory.
The final thing you have to do is go into the Admin Console. Click on the Authentication left menu. Click on the Required Actions tab. Click on the Register button and choose your new Required Action. Your new required action should now be displayed and enabled in the required actions list.
Customizing required actions in KeyCloak can provide several benefits for developers, including:
With custom-required actions, you may offer an enhanced user experience for your software or application. For example, you might create a required action on the email and phone number field to collect user data during account registration.
One of the most important factors is business security. Isn't it? You may customize required actions prompting users to complete additional processes while authenticating features or resources.
Developers may extend the functionality of KeyCloak using required actions and add new behaviors or features to the IAM solution.
These are the top three benefits of KeyCloak required actions that help businesses keep their apps (or software) secure and efficient. I hope you have learned something new about enhancing application security. For more such articles, do visit our blog section.
If you need Java and Kotlin app development services, our seasoned experts are here to assist you. Get in touch with us to discuss your needs.
This blog has discussed the introduction of KeyCloak and its customization using the required actions. KeyCloak provides a powerful set of tools for managing authentication and authorization in modern applications and services. By customizing required actions, developers can tailor the user experience, enhance security, and extend the functionality of KeyCloak to meet the specific needs of their application. With a little bit of Java expertise, it's easy to get started with creating custom-required actions in KeyCloak, and the benefits can be significant.
Build Your Agile Team
Let's rewind to the 1990s. Data used to be stored on servers and CEOs relied on basic tools to make optimal decisions. No dashboards, nothing. When you use Power BI with a solid...
Imagine walking into a meeting where critical decisions need to be made—fast. You need clear, flexible data that you can analyze on the spot. But what if your insights are locked inside...
Clear insights mean smarter decisions, and this is what data storytelling does. It helps you speak a language that you quickly understand. Like for example, you are a CTO dealing with...