title | titleSuffix | description | author | ms.author | ms.reviewer | ms.date | ms.topic | ms.custom |
---|---|---|---|---|---|---|---|---|
Enable WebLogic app sign-in and access to Microsoft Graph |
Azure |
Shows you how to develop a Java WebLogic app to sign in users and call Microsoft Graph with the Microsoft identity platform. |
KarlErickson |
karler |
bbanerjee |
03/11/2024 |
article |
devx-track-identity-java, devx-track-java, devx-track-extended-java |
This article demonstrates a Java WebLogic app that signs in users and obtains an access token for calling Microsoft Graph. It uses the Microsoft Authentication Library (MSAL) for Java.
[!INCLUDE scenario-authorization-graph.md]
[!INCLUDE prerequisites-authorization-graph.md]
[!INCLUDE prerequisites-weblogic.md]
[!INCLUDE java-servlet-overview-recommendation.md]
[!INCLUDE enable-java-servlet-webapp-authorization-entra-id.md]
These instructions assume that you installed WebLogic and set up some server domain.
Before you can deploy to WebLogic, use the following steps to make some configuration changes in the sample itself and then build or rebuild the package:
-
In the sample, find the application.properties or authentication.properties file where you configured the client ID, tenant, redirect URL, and so on.
-
In this file, change references to
localhost:8080
orlocalhost:8443
to the URL and port that WebLogic runs on, which by default should belocalhost:7001
. -
You also need to make the same change in the Azure app registration, where you set it in the Azure portal as the Redirect URI value on the Authentication tab.
Use the following steps to deploy the sample to WebLogic via the web console:
-
Start the WebLogic server with DOMAIN_NAME\bin\startWebLogic.cmd.
-
Navigate to the WebLogic web console in your browser at
http://localhost:7001/console
. -
Go to Domain Structure > Deployments, select Install, select Upload your files, and then find the .war file that you built using Maven.
-
Select Install this deployment as an application, select Next, select Finish, and then select Save.
-
Most of the default settings should be fine except that you should name the application to match the redirect URI you set in the sample configuration or Azure app registration. That is, if the redirect URI is
http://localhost:7001/msal4j-servlet-auth
, then you should name the applicationmsal4j-servlet-auth
. -
Go back to Domain Structure > Deployments, and start your application.
-
After the application starts, navigate to
http://localhost:7001/<application-name>/
, and you should be able to access the application.
[!INCLUDE enable-java-servlet-webapp-authorization-entra-id-explore.md]
Deploy Java WebLogic apps to WebLogic on Azure Virtual Machines