Over a million developers have joined DZone.

Custom Authenticator for WSO2 Identity Server (WSO2IS) SSO Login

DZone 's Guide to

Custom Authenticator for WSO2 Identity Server (WSO2IS) SSO Login

Need a custom authenticator for your WSO2 Identity Server SSO login? We've got you covered. Let's look at implementing a WSO2IS authenticator, and extend the basic authenticator.

· Integration Zone ·
Free Resource

In SSO login, you can plug different custom authenticators in to the WSO2IS. There are two major types. One is local authenticators and other one is Federated Authenticators. Federated authenticators are needed when you need to provide browser based redirections to another IDP. As an example Salesforce, Google, Facebook IDPs. (More details from here). In other cases, we can implement a local authenticator.

Default authenticator of WSO2IS, is the Basic authenticator and it is also a local authenticator which authenticates the end user with connected user store using provided username and password.

In this post, lets try to implement a local authenticator for WSO2IS by extending the basic authenticator.
Lets take following two sample requirements.

1. Users who are login using “OpenId Connect” must be authenticated with user store and must be authorized. In authorization, user must be verified that user is assigned to the specific role called “openidConnectRole”

2. Users who are from application (service provider) “soasecurity.org” must be authenticated with user store and must be authorized. In authorization, user must be verified that user contains a specific attribute. As an example, user contains a mail with domain “soasecurity.org”

Step 1. Extend the Basic Authenticator and implement a new authenticator.

As we are only worry about authorization, Authentication can be happened as in the Basic Authenticator level. We need to add authorization logic after the authentication. Therefore we only need to extend an one method in the Basic Authenticator which is “processAuthenticationResponse()”

Also, we need to modify the authenticator name by extending “getFriendlyName()” and “getName()” methods.

You can fine the extend authenticator source from here.

Step 2. Create OSGI bundle out of your extended authenticator. Sample project can be found from here. You can build the project using maven3

Step 3. Deploy OSGI bundle in WSO2 Identity Server (or APIM) by copying in to /repository/components/dropins directory.

Step 4. You need to edit the /repository/deployment/server/webapps/authenticationendpoint/login.jsp page with your new authenticator name.

Because currently it is set to “BasicAuthenticator”. You can modify it as following by adding check for “BasicCustomAuthenticator”

if(localAuthenticatorNames.contains("BasicAuthenticator") | localAuthenticatorNames.contains("BasicCustomAuthenticator")){

 if(localAuthenticatorNames.size()>0 && (localAuthenticatorNames.contains("BasicAuthenticator") || } else if(localAuthenticatorNames.size()>0 && (localAuthenticatorNames.contains("BasicAuthenticator") || localAuthenticatorNames.contains("BasicCustomAuthenticator"))) {localAuthenticatorNames.contains("BasicCustomAuthenticator"))) {

Step 5. (Optional) If you need to make this as the default authenticator for all service providers, you can configure it using /repository/conf/identity/service-providers/default.xmlfile.

This file is configured to “BasicAuthenticator” by default...You can modify it to “BasicCustomAuthenticator” by changing following two properties.


in to


Step 6. Restart the server.

Step 7. You can login to management console and configure new authenticator for each service provider using “Local & Outbound Authentication Configuration”


Step 8. Try out.

You can debug the custom authenticator source by starting server in debug mode.

>sh wso2server.sh -debug 5005

Thanks for reading…!!!

ei ,integration ,enterprise integration ,wso2is

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}