You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this quickstart, you'll learn how to integrate a Java web application with the Microsoft identity platform. Your app will sign in a user, get an access token to call the Microsoft Graph API, and make a request to the Microsoft Graph API.
20
20
21
-
When you've completed this quickstart, your application will accept sign-ins of personal Microsoft accounts (including outlook.com, live.com, and others) and work or school accounts from any company or organization that uses Azure Active Directory.
22
-
23
-

21
+
When you've completed this quickstart, your application will accept sign-ins of personal Microsoft accounts (including outlook.com, live.com, and others) and work or school accounts from any company or organization that uses Azure Active Directory. (See [How the sample works](#how-the-sample-works) for an illustration.)
24
22
25
23
## Prerequisites
26
24
27
25
To run this sample you will need:
28
26
29
27
-[Java Development Kit (JDK)](https://openjdk.java.net/) 8 or greater, and [Maven](https://maven.apache.org/).
30
-
- An Azure Active Directory (Azure AD) tenant. For more information on how to get an Azure AD tenant, see [How to get an Azure AD tenant](https://azure.microsoft.com/documentation/articles/active-directory-howto-tenant/).
31
28
32
29
> [!div renderon="docs"]
33
30
> ## Register and download your quickstart app
@@ -69,7 +66,7 @@ To run this sample you will need:
69
66
>
70
67
> For the code sample for this quickstart to work, you need to:
71
68
>
72
-
> 1. Add reply URLs as `https://localhost:8080/msal4jsamples/secure/aad` and `https://localhost:8080/msal4jsamples/graph/me`.
69
+
> 1. Add reply URLs as `https://localhost:8080/msal4jsample/secure/aad` and `https://localhost:8080/msal4jsample/graph/me`.
@@ -78,46 +75,65 @@ To run this sample you will need:
78
75
> >  Your application is configured with these attributes.
79
76
80
77
#### Step 2: Download the code sample
78
+
> [!div renderon="docs"]
79
+
> [Download the Code Sample](https://github.com/Azure-Samples/ms-identity-java-webapp/archive/master.zip)
81
80
82
-
[Download the Code Sample](https://github.com/Azure-Samples/ms-identity-java-webapp/archive/master.zip)
83
-
84
-
#### Step 3: Configure the code sample
85
-
86
-
1. Extract the zip file to a local folder.
87
-
1. If you use an integrated development environment, open the sample in your favorite IDE (optional).
88
-
1. Open the application.properties file, which can be found in src/main/resources/ folder and replace the value of the fields *aad.clientId*, *aad.authority* and *aad.secretKey* with the respective values of **Application Id**, **Tenant Id** and **Client Secret** as the following:
> - `Enter_the_Application_Id_here` - is the Application Id for the application you registered.
103
-
> - `Enter_the_Client_Secret_Here` - is the **Client Secret** you created in **Certificates & Secrets** for the application you registered.
104
-
> - `Enter_the_Tenant_Info_Here` - is the **Directory (tenant) ID** value of the application you registered.
105
-
106
-
1. To use https with localhost, fill in the server.ssl.key properties. To generate a self-signed certificate, use the keytool utility (included in JRE).
> Download the project and extract the zip file to a local folder closer to the root folder - for example, **C:\Azure-Samples**
83
+
>
84
+
> To use https with localhost, fill in the server.ssl.key properties. To generate a self-signed certificate, use the keytool utility (included in JRE).
> 1. If you use an integrated development environment, open the sample in your favorite IDE (optional).
104
+
> 1. Open the application.properties file, which can be found in src/main/resources/ folder and replace the value of the fields *aad.clientId*, *aad.authority* and *aad.secretKey* with the respective values of **Application Id**, **Tenant Id** and **Client Secret** as the following:
> - `Enter_the_Application_Id_here` - is the Application Id for the application you registered.
117
+
> - `Enter_the_Client_Secret_Here` - is the **Client Secret** you created in **Certificates & Secrets** for the application you registered.
118
+
> - `Enter_the_Tenant_Info_Here` - is the **Directory (tenant) ID** value of the application you registered.
119
+
> 1. To use https with localhost, fill in the server.ssl.key properties. To generate a self-signed certificate, use the keytool utility (included in JRE).
> Put the generated keystore file in the "resources" folder.
117
131
118
-
Put the generated keystore file in the "resources" folder.
119
132
120
-
#### Step 4: Run the code sample
133
+
> [!div class="sxs-lookup" renderon="portal"]
134
+
> #### Step 3: Run the code sample
135
+
> [!div renderon="docs"]
136
+
> #### Step 4: Run the code sample
121
137
122
138
To run the project, you can either:
123
139
@@ -133,11 +149,16 @@ If you are running the web application from an IDE, click on run, then navigate
133
149
- *Sign Out*: Signs the current user out of the application and redirects them to the home page.
134
150
- *Show User Info*: Acquires a token for Microsoft Graph and calls Microsoft Graph with a request containing the token, which returns basic information about the signed-in user.
135
151
152
+
153
+
136
154
> [!IMPORTANT]
137
155
> This quickstart application uses a client secret to identify itself as confidential client. Because the client secret is added as a plain-text to your project files, for security reasons it is recommended that you use a certificate instead of a client secret before considering the application as production application. For more information on how to use a certificate, see [Certificate credentials for application authentication](https://docs.microsoft.com/azure/active-directory/develop/active-directory-certificate-credentials).
138
156
139
157
## More information
140
158
159
+
### How the sample works
160
+

161
+
141
162
### Getting MSAL
142
163
143
164
MSAL for Java (MSAL4J) is the Java library used to sign in users and request tokens used to access an API protected by the Microsoft identity Platform.
0 commit comments