Skip to content

Commit 4aae05d

Browse files
authored
Merge pull request #47538 from SomkaPe/patch-1
https configuration for localhost
2 parents a16812e + 100a6a9 commit 4aae05d

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

articles/active-directory/develop/quickstart-v2-java-webapp.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ To run this sample you will need:
5757
> - Leave **Redirect URI** blank for now, and select **Register**.
5858
> 1. On the **Overview** page, find the **Application (client) ID** and the **Directory (tenant) ID** values of the application. Copy these values for later.
5959
> 1. Select the **Authentication** from the menu, and then add the following information:
60-
> - In **Redirect URIs**, add `http://localhost:8080/msal4jsample/secure/aad` and `http://localhost:8080/msal4jsample/graph/me`.
60+
> - In **Redirect URIs**, add `https://localhost:8080/msal4jsample/secure/aad` and `https://localhost:8080/msal4jsample/graph/me`.
6161
> - Select **Save**.
6262
> 1. Select the **Certificates & secrets** from the menu and in the **Client secrets** section, click on **New client secret**:
6363
>
@@ -71,7 +71,7 @@ To run this sample you will need:
7171
>
7272
> For the code sample for this quickstart to work, you need to:
7373
>
74-
> 1. Add reply URLs as `http://localhost:8080/msal4jsamples/secure/aad` and `http://localhost:8080/msal4jsamples/graph/me`.
74+
> 1. Add reply URLs as `https://localhost:8080/msal4jsamples/secure/aad` and `https://localhost:8080/msal4jsamples/graph/me`.
7575
> 1. Create a Client Secret.
7676
> > [!div renderon="portal" id="makechanges" class="nextstepaction"]
7777
> > [Make these changes for me]()
@@ -87,23 +87,36 @@ To run this sample you will need:
8787

8888
1. Extract the zip file to a local folder.
8989
1. If you use an integrated development environment, open the sample in your favorite IDE (optional).
90-
9190
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:
9291

9392
```file
9493
aad.clientId=Enter_the_Application_Id_here
9594
aad.authority=https://login.microsoftonline.com/Enter_the_Tenant_Info_Here/
9695
aad.secretKey=Enter_the_Client_Secret_Here
97-
aad.redirectUriSignin=http://localhost:8080/msal4jsample/secure/aad
98-
aad.redirectUriGraph=http://localhost:8080/msal4jsample/graph/me
96+
aad.redirectUriSignin=https://localhost:8080/msal4jsample/secure/aad
97+
aad.redirectUriGraph=https://localhost:8080/msal4jsample/graph/me
9998
```
10099
101-
> [!div renderon="docs"]
102-
> Where:
103-
>
104-
> - `Enter_the_Application_Id_here` - is the Application Id for the application you registered.
105-
> - `Enter_the_Client_Secret_Here` - is the **Client Secret** you created in **Certificates & Secrets** for the application you registered.
106-
> - `Enter_the_Tenant_Info_Here` - is the **Directory (tenant) ID** value of the application you registered.
100+
> [!div renderon="docs"]
101+
> Where:
102+
>
103+
> - `Enter_the_Application_Id_here` - is the Application Id for the application you registered.
104+
> - `Enter_the_Client_Secret_Here` - is the **Client Secret** you created in **Certificates & Secrets** for the application you registered.
105+
> - `Enter_the_Tenant_Info_Here` - is the **Directory (tenant) ID** value of the application you registered.
106+
107+
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).
108+
109+
```
110+
Example:
111+
keytool -genkeypair -alias testCert -keyalg RSA -storetype PKCS12 -keystore keystore.p12 -storepass password
112+
113+
server.ssl.key-store-type=PKCS12
114+
server.ssl.key-store=classpath:keystore.p12
115+
server.ssl.key-store-password=password
116+
server.ssl.key-alias=testCert
117+
```
118+
119+
Put the generated keystore file in the "resources" folder.
107120
108121
#### Step 4: Run the code sample
109122
@@ -113,11 +126,11 @@ Run it directly from your IDE by using the embedded spring boot server or packag
113126
114127
##### Running from IDE
115128
116-
If you are running the web application from an IDE, click on run, then navigate to the home page of the project. For this sample, the standard home page URL is http://localhost:8080
129+
If you are running the web application from an IDE, click on run, then navigate to the home page of the project. For this sample, the standard home page URL is https://localhost:8080.
117130
118131
1. On the front page, select the **Login** button to redirect to Azure Active Directory and prompt the user for their credentials.
119132
120-
1. After the user is authenticated, they are redirected to *http://localhost:8080/msal4jsample/secure/aad*. They are now signed in, and the page will show information about the signed-in account. The sample UI has the following buttons:
133+
1. After the user is authenticated, they are redirected to *https://localhost:8080/msal4jsample/secure/aad*. They are now signed in, and the page will show information about the signed-in account. The sample UI has the following buttons:
121134
- *Sign Out*: Signs the current user out of the application and redirects them to the home page.
122135
- *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.
123136

0 commit comments

Comments
 (0)