Enable Login for an OIDC Web Application¶
This page guides you through enabling login for an OpenID Connect web application.
Prerequisites¶
-
Download Apache Tomcat 8.x and install it. Tomcat server installation location will later be referred to as
<TOMCAT_HOME>in this guide. -
It is recommended that you use a hostname that is not
localhostto avoid browser errors. Modify your machine's/etc/hostsentry to reflect this.Info
Note that
wso2is.localis used in this documentation as an example, but you must modify this when configuring the authenticators or connectors with this sample application. -
Download the OIDC pickup dispatch application from the latest release assets.
Register a service provider¶
To configure the service provider:
-
On the Management Console, go to Main > Identity > Service Providers and click Add.
-
Enter
pickup-dispatchas the Service Provider Name, and click Register. -
Expand the Inbound Authentication Configuration > OAuth/OpenID Connect Configuration section and, click Configure.
-
Select the relevant grant types that you wish to try out from the Allowed Grant Types list.
-
Enter
http://wso2is.local:8080/pickup-dispatch/oauth2clientas the Callback Url, and click Add.Tip
- Note down the OAuth Client Key and Client Secret. You will need them when deploying the sample application.
- For more information on
Callback URLfield and other advanced configurations refer, Advanced OpenID Connect Configurations
-
Click Register to add the service provider and save the configurations.
Deploy the sample web app¶
To deploy the sample web app on a web container:
-
Extract the
pickup-dispatch.warfile and open thedispatch.propertiesfile in the<EXTRACT>/WEB-INF/classesfolder. -
Replace the
consumerKeyandconsumerSecretvalues with the OAuth Client Key and Client Secret obtained when configuring the service provider.
-
Copy the modified
pickup-dispatchinto thewebappsdirectory of the Tomcat folder. -
Start the Tomcat server.
Try it out¶
Now, let's log in to the application.
- Start the Tomcat server and access the following URL on your browser:
http://localhost:8080/pickup-dispatch/home.jsp. - Click Login and enter your user credentials.
- Provide the required consent. You will be redirected to the Pickup Dispatch application home page.
You have successfully configured authentication for a OIDC application.
Related topics