How to secure Azure Mobile Service with Azure AD? ADAL.JS

I created an application in my Azure AD. I switch to the mobile service and go to the identification tab. For identification, the MS requests a client identifier. I found the client ID on the Azure AD Setup tab.

However, I had no idea what to use for Client Secret and the SID package. It looks like you are expecting to use the Windows Store app to access the service, not the Javascript application I'm working with.

So, to my question: how do you protect the Azure Mobile Service with Azure AD when the AngularJS web application accesses the service?

(I don’t want to use Google because I want to control the users who can access them, so I will manually add users to Azure AD so that I want to provide access to this service.)

UPDATE:

In response below, I tried using ADAL.JS. It "basically works" with the following problems.

  • Chrome is blocked - it does not work.

  • When using a Microsoft account added to my Azure AD domain, it just goes into a loop and redirects me.

+1
source share
1 answer

In the mobile service authentication configuration for Azure AD, the following parameters are requested upon your request

  • App url
  • Customer id
  • Allowed tenants

The SID of the packet is associated with MSA account authentication. Azure AD is the last at the bottom.

Refer to: Register your applications to use Azure Active Directory account login

In Azure AD, you need to create an application that matches the client ID and application ID with information on the mobile service side.

Other important information to fill out here:

  • Answer URL: You must have a record with the URI of your web application (Angular hosting)
  • Allow Enable single sign-on and read user profiles as delegated permission
  • Allow implicit OAuth flow by editing and updating the application manifest file

For more detailed steps to follow, especially about the last item on my list, look at this sample https://github.com/AzureADSamples/SinglePageApp-AngularJS-DotNet and its README

After you receive the access token through the ADAL.JS libraries, you can use it to call the Mobile Service login method, simply providing the correct authentication provider name, and the access token obtained using ADAL.JS

Using ADAL.JS instead of the Mobile Services SDK to obtain an access token also gives you an update token, which you can cache and store to update the automatic access token; not allowing the user to enter credentials every time

+3
source

Source: https://habr.com/ru/post/988510/


All Articles