├── 4-Deployment └── deploy-to-azure-app-service │ ├── .gitignore │ ├── ReadmeFiles │ ├── topology.png │ └── disable_easy_auth.png │ ├── CHANGELOG.md │ ├── .github │ ├── CODE_OF_CONDUCT.md │ ├── ISSUE_TEMPLATE.md │ └── PULL_REQUEST_TEMPLATE.md │ └── LICENSE.md ├── .DS_Store ├── ReadmeFiles ├── sign-in.png ├── sign-in-2.png └── topology.png ├── 1-Authentication ├── sign-in │ ├── ReadmeFiles │ │ ├── app.png │ │ └── topology.png │ ├── src │ │ └── main │ │ │ ├── webapp │ │ │ ├── static │ │ │ │ ├── favicon.ico │ │ │ │ └── style.css │ │ │ ├── content │ │ │ │ ├── 500.jsp │ │ │ │ ├── 401.jsp │ │ │ │ ├── token.jsp │ │ │ │ ├── status.jsp │ │ │ │ └── survey.jsp │ │ │ └── navbar.jsp │ │ │ ├── resources │ │ │ ├── log4j.properties │ │ │ └── authentication.properties │ │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azuresamples │ │ │ └── msal4j │ │ │ ├── helpers │ │ │ ├── AuthException.java │ │ │ ├── IdentityContextAdapter.java │ │ │ └── IdentityContextAdapterServlet.java │ │ │ ├── feedback │ │ │ └── SurveyServlet.java │ │ │ ├── authwebapp │ │ │ ├── SignInStatusServlet.java │ │ │ ├── AuthErrorDetailsServlet.java │ │ │ └── TokenDetailsServlet.java │ │ │ └── authservlets │ │ │ ├── SignOutServlet.java │ │ │ ├── SignInServlet.java │ │ │ └── AADRedirectServlet.java │ ├── CHANGELOG.md │ ├── .gitignore │ ├── .github │ │ ├── CODE_OF_CONDUCT.md │ │ ├── ISSUE_TEMPLATE.md │ │ └── PULL_REQUEST_TEMPLATE.md │ ├── LICENSE.md │ ├── .classpath │ └── AppCreationScripts │ │ ├── sample.json │ │ └── Cleanup.ps1 └── sign-in-b2c │ ├── ReadmeFiles │ ├── app.png │ └── topology.png │ ├── src │ └── main │ │ ├── webapp │ │ ├── static │ │ │ ├── favicon.ico │ │ │ └── style.css │ │ ├── auth │ │ │ ├── 401.jsp │ │ │ ├── auth-bar.jsp │ │ │ ├── token.jsp │ │ │ └── status.jsp │ │ ├── navbar.jsp │ │ └── index.jsp │ │ ├── resources │ │ ├── log4j.properties │ │ └── authentication.properties │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azuresamples │ │ └── authenticationb2c │ │ ├── AADPasswordResetException.java │ │ ├── SignInStatusServlet.java │ │ ├── SignOutServlet.java │ │ ├── SignInServlet.java │ │ ├── EditProfileServlet.java │ │ ├── AADRedirectServlet.java │ │ ├── AuthenticationFilter.java │ │ ├── TokenDetailsServlet.java │ │ └── Config.java │ ├── CHANGELOG.md │ ├── .github │ ├── CODE_OF_CONDUCT.md │ ├── ISSUE_TEMPLATE.md │ └── PULL_REQUEST_TEMPLATE.md │ ├── .gitignore │ └── LICENSE.md ├── 3-Authorization-II ├── groups │ ├── ReadmeFiles │ │ ├── app.png │ │ └── topology.png │ ├── src │ │ └── main │ │ │ ├── webapp │ │ │ ├── static │ │ │ │ ├── favicon.ico │ │ │ │ └── style.css │ │ │ ├── content │ │ │ │ ├── 500.jsp │ │ │ │ ├── 401.jsp │ │ │ │ ├── 200.jsp │ │ │ │ ├── token.jsp │ │ │ │ ├── survey.jsp │ │ │ │ ├── status.jsp │ │ │ │ ├── 403.jsp │ │ │ │ └── groups.jsp │ │ │ └── navbar.jsp │ │ │ ├── resources │ │ │ ├── log4j.properties │ │ │ └── authentication.properties │ │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azuresamples │ │ │ └── msal4j │ │ │ ├── helpers │ │ │ ├── AuthException.java │ │ │ ├── IdentityContextAdapter.java │ │ │ └── IdentityContextAdapterServlet.java │ │ │ ├── feedback │ │ │ └── SurveyServlet.java │ │ │ ├── groupswebapp │ │ │ ├── SignInStatusServlet.java │ │ │ ├── AuthErrorDetailsServlet.java │ │ │ ├── TokenDetailsServlet.java │ │ │ ├── GroupProtectedPageServlet.java │ │ │ └── GroupsServlet.java │ │ │ └── authservlets │ │ │ ├── SignOutServlet.java │ │ │ ├── SignInServlet.java │ │ │ └── AADRedirectServlet.java │ ├── CHANGELOG.md │ ├── .gitignore │ ├── .github │ │ ├── CODE_OF_CONDUCT.md │ │ ├── ISSUE_TEMPLATE.md │ │ └── PULL_REQUEST_TEMPLATE.md │ ├── AppCreationScripts │ │ ├── BulkRemoveGroups.ps1 │ │ ├── BulkCreateGroups.ps1 │ │ ├── sample.json │ │ └── Cleanup.ps1 │ ├── LICENSE.md │ └── .classpath └── roles │ ├── ReadmeFiles │ └── app.png │ ├── src │ └── main │ │ ├── webapp │ │ ├── static │ │ │ ├── favicon.ico │ │ │ └── style.css │ │ ├── content │ │ │ ├── 500.jsp │ │ │ ├── 401.jsp │ │ │ ├── auth-bar.jsp │ │ │ ├── 200.jsp │ │ │ ├── token.jsp │ │ │ ├── 403.jsp │ │ │ ├── survey.jsp │ │ │ └── status.jsp │ │ └── navbar.jsp │ │ ├── resources │ │ ├── log4j.properties │ │ └── authentication.properties │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azuresamples │ │ └── msal4j │ │ ├── helpers │ │ ├── AuthException.java │ │ ├── IdentityContextAdapter.java │ │ └── IdentityContextAdapterServlet.java │ │ ├── feedback │ │ └── SurveyServlet.java │ │ ├── roles │ │ ├── SignInStatusServlet.java │ │ ├── AuthErrorDetailsServlet.java │ │ ├── TokenDetailsServlet.java │ │ └── RoleProtectedPageServlet.java │ │ └── authservlets │ │ ├── SignOutServlet.java │ │ ├── SignInServlet.java │ │ └── AADRedirectServlet.java │ ├── CHANGELOG.md │ ├── .github │ ├── CODE_OF_CONDUCT.md │ ├── ISSUE_TEMPLATE.md │ └── PULL_REQUEST_TEMPLATE.md │ ├── .gitignore │ ├── LICENSE.md │ ├── .classpath │ └── AppCreationScripts │ ├── sample.json │ ├── CleanupUsersAndRoles.ps1 │ └── Cleanup.ps1 ├── 2-Authorization-I └── call-graph │ ├── ReadmeFiles │ ├── app.png │ └── topology.png │ ├── src │ └── main │ │ ├── webapp │ │ ├── static │ │ │ ├── favicon.ico │ │ │ └── style.css │ │ ├── content │ │ │ ├── 500.jsp │ │ │ ├── 401.jsp │ │ │ ├── token.jsp │ │ │ ├── graph.jsp │ │ │ ├── survey.jsp │ │ │ └── status.jsp │ │ └── navbar.jsp │ │ ├── resources │ │ ├── log4j.properties │ │ └── authentication.properties │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azuresamples │ │ └── msal4j │ │ ├── helpers │ │ ├── AuthException.java │ │ ├── IdentityContextAdapter.java │ │ └── IdentityContextAdapterServlet.java │ │ ├── feedback │ │ └── SurveyServlet.java │ │ ├── callgraphwebapp │ │ ├── SignInStatusServlet.java │ │ ├── AuthErrorDetailsServlet.java │ │ └── TokenDetailsServlet.java │ │ └── authservlets │ │ ├── SignOutServlet.java │ │ ├── SignInServlet.java │ │ └── AADRedirectServlet.java │ ├── CHANGELOG.md │ ├── .github │ ├── CODE_OF_CONDUCT.md │ ├── ISSUE_TEMPLATE.md │ └── PULL_REQUEST_TEMPLATE.md │ ├── .gitignore │ ├── LICENSE.md │ ├── AppCreationScripts │ ├── sample.json │ └── Cleanup.ps1 │ └── .classpath ├── CHANGELOG.md ├── .gitignore ├── .github ├── workflows │ ├── 1-Authentication-sign-in.yml │ ├── 3-Authorization-II-roles.yml │ ├── 3-Authorization-II-groups.yml │ ├── 1-Authentication-sign-in-b2c.yml │ └── 2-Authorization-I-call-graph.yml └── dependabot.yml └── LICENSE.md /4-Deployment/deploy-to-azure-app-service/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/.DS_Store -------------------------------------------------------------------------------- /ReadmeFiles/sign-in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/ReadmeFiles/sign-in.png -------------------------------------------------------------------------------- /ReadmeFiles/sign-in-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/ReadmeFiles/sign-in-2.png -------------------------------------------------------------------------------- /ReadmeFiles/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/ReadmeFiles/topology.png -------------------------------------------------------------------------------- /1-Authentication/sign-in/ReadmeFiles/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/1-Authentication/sign-in/ReadmeFiles/app.png -------------------------------------------------------------------------------- /3-Authorization-II/groups/ReadmeFiles/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/3-Authorization-II/groups/ReadmeFiles/app.png -------------------------------------------------------------------------------- /3-Authorization-II/roles/ReadmeFiles/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/3-Authorization-II/roles/ReadmeFiles/app.png -------------------------------------------------------------------------------- /1-Authentication/sign-in-b2c/ReadmeFiles/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/1-Authentication/sign-in-b2c/ReadmeFiles/app.png -------------------------------------------------------------------------------- /2-Authorization-I/call-graph/ReadmeFiles/app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/2-Authorization-I/call-graph/ReadmeFiles/app.png -------------------------------------------------------------------------------- /1-Authentication/sign-in/ReadmeFiles/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/1-Authentication/sign-in/ReadmeFiles/topology.png -------------------------------------------------------------------------------- /3-Authorization-II/groups/ReadmeFiles/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/3-Authorization-II/groups/ReadmeFiles/topology.png -------------------------------------------------------------------------------- /1-Authentication/sign-in-b2c/ReadmeFiles/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/1-Authentication/sign-in-b2c/ReadmeFiles/topology.png -------------------------------------------------------------------------------- /2-Authorization-I/call-graph/ReadmeFiles/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/2-Authorization-I/call-graph/ReadmeFiles/topology.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /1-Authentication/sign-in/src/main/webapp/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/1-Authentication/sign-in/src/main/webapp/static/favicon.ico -------------------------------------------------------------------------------- /3-Authorization-II/groups/src/main/webapp/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/3-Authorization-II/groups/src/main/webapp/static/favicon.ico -------------------------------------------------------------------------------- /3-Authorization-II/roles/src/main/webapp/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/3-Authorization-II/roles/src/main/webapp/static/favicon.ico -------------------------------------------------------------------------------- /1-Authentication/sign-in-b2c/src/main/webapp/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/1-Authentication/sign-in-b2c/src/main/webapp/static/favicon.ico -------------------------------------------------------------------------------- /2-Authorization-I/call-graph/src/main/webapp/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/2-Authorization-I/call-graph/src/main/webapp/static/favicon.ico -------------------------------------------------------------------------------- /4-Deployment/deploy-to-azure-app-service/ReadmeFiles/topology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/4-Deployment/deploy-to-azure-app-service/ReadmeFiles/topology.png -------------------------------------------------------------------------------- /1-Authentication/sign-in/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /3-Authorization-II/roles/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /1-Authentication/sign-in-b2c/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /2-Authorization-I/call-graph/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /3-Authorization-II/groups/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /4-Deployment/deploy-to-azure-app-service/ReadmeFiles/disable_easy_auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure-Samples/ms-identity-java-servlet-webapp-authentication/HEAD/4-Deployment/deploy-to-azure-app-service/ReadmeFiles/disable_easy_auth.png -------------------------------------------------------------------------------- /4-Deployment/deploy-to-azure-app-service/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /1-Authentication/sign-in/src/main/webapp/content/500.jsp: -------------------------------------------------------------------------------- 1 |
7 | ${details}
8 |
7 | ${details}
8 |
7 | ${details}
8 |
7 | ${details}
8 |
7 | Visiting this page requires you to be authenticated. Use the button on the top right to sign in. 8 |
9 |7 | Visiting this page requires you to be authenticated. Use the button on the top right to sign in. 8 |
9 |7 | Visiting this page requires you to be authenticated. Use the button on the top right to sign in. 8 |
9 |7 | Visiting this page requires you to be authenticated. Use the button on the top right to sign in. 8 |
9 |8 | Visiting this page requires you to be authenticated. Use the button on the top right to sign in. 9 |
10 | 11 |
8 |
11 |
13 | Click here to see your Sign-in Status
14 |
8 |
11 |
13 | Click here to see your Sign-in Status
14 | or Call Graph
15 |
8 |
11 |
13 | Click here to see your Sign-in Status
14 | or Token Details
15 |
9 | Excellent! You are a member of the group(s) that are allowed to visit this page!
10 |
11 | ">Groups
12 | ">Admins Only
13 | ">Regular Users
14 |
9 | Excellent! You are a member of the role(s) that are allowed to visit this page!
10 |
11 | ">ID Token Details
12 | ">Admins Only
13 | ">Regular Users
14 |
9 |
11 |
9 |
12 |
14 | ">Admins Only
15 | ">Regular Users
16 |
9 | Visiting this page requires the signed in user to be assigned to the correct role(s) as defined in the authentication.properties file.
10 |
11 |
12 | ">ID Token Details
13 | ">Admins Only
14 | ">Regular Users
15 |
10 |
9 |
12 |
14 | ">Groups
15 | ">Admins Only
16 | ">Regular Users
17 |
9 | 10 |
11 |9 | 10 |
11 |10 | 11 |
12 |10 | 11 |
12 |
10 |
11 | <% if (msalAuth.getAuthenticated()) { %>
12 | Click here to get your ">ID Token Details
13 | or ">Edit Your Profile
14 | <% } else { %>
15 | Use the button on the top right to sign in.
16 |
17 | Note: You may have been signed out as a result of a password reset or edit profile.
18 | <% } %>
19 |
10 | <% if (msalAuth.getAuthenticated()) { %> 11 | ">ID Token Details 12 | ">Admins Only 13 | ">Regular Users 14 | <% } else { %> 15 | Use the button on the top right to sign in. 16 | Attempts to visit ">ID Token Details, 17 | ">Admins Only, 18 | or ">Regular Users 19 | will result in a 401 error. 20 | <% } %> 21 |
22 |10 | <% if (msalAuth.getAuthenticated()) { %> 11 | ">ID Token Details 12 | ">Groups 13 | ">Admins Only 14 | ">Regular Users 15 | <% } else { %> 16 | Use the button on the top right to sign in. 17 | Attempts to visit ">ID Token Details, 18 | ">Groups, 19 | ">Admins Only, 20 | or ">Regular Users 21 | will result in a 401 error. 22 | <% } %> 23 |
24 |
9 | Visiting this page requires the signed in user to be assigned to the correct group(s)
10 | as defined in the authentication.properties file.
11 |
12 | Click the Groups button to check if you are a member of any security groups that have been emitted in
13 | the ID token or obtained via Microsoft Graph. If you you do not see any groups, use the Readme
14 | instructions to add your user to one or more security
15 | groups. Follow the guidance in the Readme to make sure that the groups will be emitted in the ID token.
16 |
17 | If you do see group memberships, copy some values and enter them into the relevant fields in the
18 | authentication.properties file.
19 | Use "mvn clean package" and then restart the app.
20 |
21 | ">Groups
22 | ">Admins Only
23 | ">Regular Users
24 |
8 |
13 |
20 | Using the information in the token, the app has called Microsoft Graph to get your group
21 | memberships.
22 |
23 |
27 | ${groups}
28 |
29 |
30 | ">Token Details
31 | ">Admins Only
32 | ">Regular Users
33 |