Skip to content

Azure-Samples/ms-identity-msal-java-samples

Repository files navigation

languages products page_type urlFragment description
java
msal-java
azure
entra
sample
introduction-msal-java
Securing Java apps using the Microsoft Identity platform and MSAL Java

Securing Java apps using the Microsoft Identity platform and MSAL Java

About these samples

Scenarios

The Microsoft Authentication Library (MSAL) enables developers to acquire tokens from the Microsoft identity platform, allowing applications to authenticate users and access secured web APIs. It can be used to provide secure access to Microsoft Graph, other Microsoft APIs, third-party web APIs, or your own web API.

This collection of samples covers a number of scenarios where MSAL Java can be used to secure Java applications, and is meant to build an understanding of MSAL Java and demonstrate how to integrate the library into your applications.

Prerequisites

These are the basic prerequisites for each sample, though each sample may specify more in their own README.

Structure of the repository

This repository contains scenario-specific samples and comprehensive tutorials. We recommend starting with the MSAL Java documentation to get familiar with MSAL Java, and then try out the samples that best fit your use case.

Chapters 1 and 2 are collections of samples covering specific use cases which demonstrate how to integrate MSAL Java into your application, and chapters 3 and 4 are more comprehensive tutorials demonstrating how to create simple and secure web apps from scratch.

Samples and Documentation

This chapter offers samples covering server-side scenarios, in which the app runs on a server and serves multiple users. These samples demonstrate securing web apps and accessing web APIs, and creating secure daemon services that can access resources on behalf of your users.

This chapter offers samples covering client-side scenarios where the app runs on a user's device, such as with desktop or mobile apps.

A tutorial demonstrating how to create a web app using MSAL Java and Java servlets.

A tutorial demonstrating how to create an MVC web app using MSAL Java alongside the Spring framework.

Community Help and Support

Use Stack Overflow to get support from the community. Ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before. Tag your questions or comments with msal and java.

If you find a bug in the sample, please open an issue.

Contributing

Thank you for your interest in contributing to Azure samples!

You can contribute to Azure samples in a few different ways:

  • Submit issues through issue tracker on GitHub. We are actively monitoring the issues and improving our samples.
  • If you wish to make code changes to samples or contribute something new, please follow the GitHub forks/pull request model - fork the sample repo, make the change, and propose it back by submitting a pull request.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.