NO.151 How can you validate that the JSON notification message is sent from the Microsoft Graph service?
clientState specifies the value of the clientState property sent by the service in each notification. The maximum length is 128 characters. The client can check that the notification came from the service by comparing the value of the clientState property sent with the subscription with the value of the clientState property received with each notification.
Note: A subscription allows a client app to receive notifications about changes to data in Microsoft Graph.
Topic 3, E-invoicing
Existing Environment
Application Architecture
E-invoicing consists of a single-page application (SPA) and a backend web service that provides invoice management and processing functionality.
E-invoicing stores all the details of each invoicing operation in a backend cloud database. E-invoicing generates invoices in PDF format and provides users with the ability to download the PDF from OneDrive after it is generated. Each invoice has a unique identifier named invoiceid.
The users have a common workflow where they sign in to E-invoicing, and then open E-invoicing in multiple tabs of a web browser so they can use different parts of the application simultaneously.
Security Architecture
Requirements
Business Goals
Planned Changes
* Email the generated invoices to customers on behalf of the current signed-in user. Any emails generated by the system will contain the invoiceid.
* Perform as many operations as possible in the browser without having to leave the E-invoicing application.
* Use Microsoft identity platform to manage identities, authentication, and authorization.
* Display all emails that contain a specific invoiceid.
Technical Requirements
* Ensure that all operations performed by E-invoicing against Microsoft 365 are initiated by a user. Require that the user authorize E-invoicing to access the Microsoft 365 data the first time the application attempts to access Microsoft 365 data on the user’s behalf.
* Send scheduled reminders to customers before a payment due date. Create an administration user interface to enable the scheduled reminders.
* Implement Microsoft Graph change notifications to detect emails from vendors that arrive in a designated mailbox.
* Implement single sign-on (SSO) and minimize login prompts across browser tabs.
* Secure access to the backend web service by using Microsoft identity platform.
* Ensure that all solutions use secure coding practices.
Backend Security Planned Changes
E-invoicing will have internal logic that will dynamically identify whether the user should be allowed to call the backend API.
SSO JavaScript Script
You plan to implement SSO with Microsoft Authentication Library (MSAL) by using the following code.
Access Token JavaScript Script
You have the following JavaScript code to obtain an access token.
Change Notification JSON
You have the following JSON message that will be sent by the Microsoft Graph service to detect the vendor emails.