active-directory-angularjs-singlepageapp | AngularJS based single page app | Azure library

 by   Azure-Samples JavaScript Version: 86474 License: No License

kandi X-RAY | active-directory-angularjs-singlepageapp Summary

kandi X-RAY | active-directory-angularjs-singlepageapp Summary

active-directory-angularjs-singlepageapp is a JavaScript library typically used in Cloud, Azure, Angular applications. active-directory-angularjs-singlepageapp has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

An AngularJS based single page app, implemented with an ASP.NET Web API backend, that signs in users and calls web APIs using Azure AD
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              active-directory-angularjs-singlepageapp has a low active ecosystem.
              It has 176 star(s) with 119 fork(s). There are 61 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 43 have been closed. On average issues are closed in 478 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of active-directory-angularjs-singlepageapp is 86474

            kandi-Quality Quality

              active-directory-angularjs-singlepageapp has 0 bugs and 0 code smells.

            kandi-Security Security

              active-directory-angularjs-singlepageapp has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              active-directory-angularjs-singlepageapp code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              active-directory-angularjs-singlepageapp does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              active-directory-angularjs-singlepageapp releases are available to install and integrate.
              active-directory-angularjs-singlepageapp saves you 43 person hours of effort in developing the same functionality from scratch.
              It has 116 lines of code, 0 functions and 21 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of active-directory-angularjs-singlepageapp
            Get all kandi verified functions for this library.

            active-directory-angularjs-singlepageapp Key Features

            No Key Features are available at this moment for active-directory-angularjs-singlepageapp.

            active-directory-angularjs-singlepageapp Examples and Code Snippets

            No Code Snippets are available at this moment for active-directory-angularjs-singlepageapp.

            Community Discussions

            QUESTION

            adal.js not working with latest version of angular and jquery
            Asked 2019-Dec-15 at 07:34

            I have to integrate my AngularJS SPA with Azure AD. There is a sample app for this (https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp). That sample is working fine and i have no problem logging in using that sample application.

            But the sample is using some very old versions of jquery (1.11.1) and angular (1.2.25). I use jquery 3.1.1 and angular 1.6.4.

            When I use those version together with the sample app i cannot login.

            I am being redirect to login.microsoftonline.com which reply with a 302 authorize respond with a very long querystring and the page is stuck there, meaning is stays with that long url in the browser address bar.

            If i change the scripts to the old version, refresh the page and try again i am logged in.

            This is the url that is in the addressbar after login https://localhost:44326/notworking.html#!/Home#id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsImtpZCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyJ9.eyJhdWQiOiJhMWNmMDk4Yy01NjJkLTQ4ZDgtYjE0OC0yZDVhMDVjM2E5ZTQiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9mNTUzZTMyOS05ZGFiLTQ3NzUtOTUyMy1lNjIyNjY4NzdlM2QvIiwiaWF0IjoxNDk3Mjc2NDYyLCJuYmYiOjE0OTcyNzY0NjIsImV4cCI6MTQ5NzI4MDM2MiwiYWlvIjoiWTJaZ1lJZ291c1AzT09LNlFkTVBkMmVYOXkvU3RwdzJmWjFtNVA5RTBMWGphTGVCbEQwQSIsImFtciI6WyJwd2QiLCJtZmEiXSwiZmFtaWx5X25hbWUiOiJGYWJpYW4iLCJnaXZlbl9uYW1lIjoiVG9ueSIsImlwYWRkciI6IjE4My44OS4zOC4zOSIsIm5hbWUiOiJUb255Iiwibm9uY2UiOiJkYTVjMzhmYy04ODNkLTRhMTItYThlYy01ZDZiYjZhNDcxNTQiLCJvaWQiOiI0YjZjYmQxYS1lMDE0LTQ5ZTYtYWI1OC0wMDdkMDZlMTNiOWIiLCJwbGF0ZiI6IjMiLCJzdWIiOiJXZTFHR05OcjUxX0VFX21hR1BjRWItcURELXlrbWFEUVE1eWVvbk8xQnRNIiwidGlkIjoiZjU1M2UzMjktOWRhYi00Nzc1LTk1MjMtZTYyMjY2ODc3ZTNkIiwidW5pcXVlX25hbWUiOiJ0b255QGZvbGxvd3RoZXNuYWtlLmNvbSIsInVwbiI6InRvbnlAZm9sbG93dGhlc25ha2UuY29tIiwidXRpIjoiTzZoTW5VMU5WRVdJdU9VZnlPVWtBQSIsInZlciI6IjEuMCJ9.cAsr5-yngyjJpMkuP6mHBSY3B0-4kFK8DNUItvB05qNalrcGHGxONG73idvUQ8gjmYrM3RfNXhZmvy2VmSx1o7CIHJouEXMelgPlnrNuboKV0m4RRRbQCmk5poP7tj_rpBZf6fFGHzPGPb_3g23hE2CetGs51BQVJHuGyygMIshR9aVRXL-_5rvLNIVWjUXK-H8cLEqXpB9INqx2_ol8D3_HGR_oqJDxSUlg3XU1cOBPeCC4r3RYkurbsoRChL-jT_DtUyP6xBCsP3odoNiKn2e8pKJHD1St0zPm34o16d4sHIE7aK2RdDnmAvQ2LowBOrcQVshIhvK5TLLNiunOQA&state=bed45624-0432-417c-8fcd-d4a1b0b5e07a&session_state=60afa4fc-05b5-4ce8-8c67-8442d34fdaf9

            And i am not logged in.

            Any ideas on how to get this to work?

            Here is my controller

            ...

            ANSWER

            Answered 2017-Jun-13 at 06:18

            Please follow the suggestion mentioned by tomidix, it fix this issue. Here is the code for your reference:

            app.js

            Source https://stackoverflow.com/questions/44501286

            QUESTION

            Oauth 2.0 | SPA | How does id_token disguise as an access_token for accessing restricted web resources?
            Asked 2019-Apr-25 at 04:59

            I am working on integrating Azure Active Directory for my Angular SPA (or any Javascript) application. Application has a front-end (built with JavaScript) and a Web API (built with any c# or any server side languages).

            For reference, https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp

            I know that I configured OAuth 2.0 Implicit Grant in SPA AAD Registration. OAuth 2.0 Implicit Grant is slightly relaxed to let SPA gaining access to web resources tied to SPA AAD Registration by redeeming 'id_token'.

            OAuth 2.0 Implicit Grant Protocol:

            1. Reach Azure Auth Endpoint with client_id, resource,.. for id_token
            2. Challenge it with credentials
            3. Get id_token as it is posted back to SPA URI.
            4. Use id_token as bearer token to access the restricted web resources.

            SPA works very well with id_token and OAuth 2.0 Implicit Grant Protocol for Internal Web API alone.

            Reason why we could not acquire access_token from SPA or JS:

            SPA could not send XHR to Azure Token Endpoint as SPA is blocked by CORS Policy of Azure Token Endpoint. So, SPA XHR could not acquire access_token.

            But, iFrames implementation of Adal.js can fetch access_token by calling cross-domain web resources.

            It looks like this is a special case for SPA alone.

            QUESTIONS:

            1. How does AAD determine which web resources that 'id_token' holder can access? By looking up the web resources tied to SPA AAD Registration?

              [OP] Adal.js is responsible for intercepting our post-backs to receive and store tokens like id_token & access_token

            2. Cannot AAD implement the following approach?

              • Redirect to Azure Auth Endpoint with client_id, resource,.. for Auth Code.
              • Acquire Authorization_Code from Azure Auth Endpoint by posting it back to SPA URI.
              • Instead for XHR to Azure Token Endpoint, can't we redirect to Azure Token Endpoint with Auth_Code, client_id, resource,.. to let Azure Token Endpoint post back the access_token back to redirect_uri?

              [OP] Adal.js had other plans to use iFrames to call Cross-domain API (Az Auth Endpoint, in this case) and acquire Access Tokens.

            P.S. I need real answers for above questions. This case is now solved :)!

            ...

            ANSWER

            Answered 2019-Apr-24 at 10:23

            How does AAD determine which web resources that 'id_token' holder can access? By looking up the web resources tied to SPA AAD Registration?

            It doesn't. If your API is configured to accept valid AAD tokens with the audience set to your front-end app's client id, it'll accept the token. This isn't a good pattern though, you should use access tokens to call APIs.

            As for your question regarding access tokens, a front-end can acquire access tokens through implicit flow by using a redirect or a hidden iframe. If you use ADAL.js or MSAL.js, they do this for you automatically if you ask for an access token from them.

            Essentially they open an iframe that goes to the /authorize endpoint with:

            • response_type=token
            • resource=https%3A%2F%2Fgraph.microsoft.com or scope=https%3A%2F%2Fgraph.microsoft.com%2FUser.Read if using v2/MSAL
            • prompt=none

            The last parameter tells AAD to not do a prompt (it's a hidden iframe). If a valid session still exists in the user's browser and consent has been granted for the scopes asked, a token is returned as a redirect to your SPA within the iframe. ADAL/MSAL then can grab the token from the iframe URL as they are running on the same host name.

            Because of the way this works, you'll want to check if you are within an iframe when your SPA loads and not render the app at all if it is.

            And no, you cannot call the /token endpoint from a JS front-end.

            Source https://stackoverflow.com/questions/55827056

            QUESTION

            Getting a valid bearer token for an app from a an angular AD client
            Asked 2019-Feb-28 at 15:28

            I have followed this guide:

            https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp

            and I connect successfully. I would like to send the bearer token to my C# server and use it to call my workbench(another AD app) functions.

            I am trying to use the bearer token I get from angular in a postman call and it is unauthorized. It is important to mention that I gave my angular client on AD permission to access my workbench instance and it's still not working, that leads me to some questions:

            I have tried using a .NET client from this guide:

            http://blog.pomiager.com/post/using-rest-api-in-azure-workbench-blockchain

            and it works. I notice here that in the AuthenticationContext object it receives credentials that is using the Client ID and the Client Secret. I notice that in the angular AD example we never use the secret. But the thing is that, when looking at the guide to create your own workbench UI, in the authService.js, it never takes the secret as a parameter as well. As can be seen here:

            https://github.com/Azure-Samples/blockchain/blob/master/blockchain-development-kit/connect/web/workbench/custom-ux-sample/src/services/authService.js

            I understand that that credentials should be set on the server. In the angular example that I provided there is also a ASP.NET server

            How can I create a valid bearer token for the workbench from the angularJS AD example? Should I replace the OWIN lib with something else?

            Thanks

            ...

            ANSWER

            Answered 2019-Feb-28 at 15:28

            You have two options:

            1. OPTION1 - Call Workbench API directly from AngularJS based SPA

              In this option you work with Implicit Grant Flow and only call Workbench API through Delegated Permissions i.e. in context of the signed in User.

              Also know that AngularJS SPA itself should not make use of any client secrets because it is a security risk and anyone using your application may be able to extract secret from JavaScript code.

              Here is a code sample from Azure Samples. This sample has TodoSPA (your AngularJS app) and ToGoAPI (separate API, analogous to WorkBench API). So you don't need to host the ToGoAPI yourself, but assume WorkBench API is your ToGoAPI. Follow the same steps just permission name 'Access To Go API' will be different and you will use Access Work Bench API instead.

              Call an Azure AD protected Web API in an AngularJS Single Page App

              Important code pieces -

              In App\Scripts\app.js, replace the property name of the endpoints object to the new location of your To Go API, which will be Workbench api url in your case. In App\Scripts\toGoListSvc.js, replace the apiEndpoint variable with the same value.

            2. OPTION2 - Create a backend API that supports your AngularJS based SPA

              AngularJS SPA calls this backend server based API, which then calls Workbench API.

              In this option you can use client secrets and work with both Delegated permissions as well as Application Permissions.

              You need this option only if you need to work with Administrator permission shown in screenshot for Workbench API shown above.

              From a flow standpoint, you can directly use Client Credentials grant flow from backend API if you don't need to call Workbench with context of a user. In case you need to call in context of a user, make use of On behalf of flow.

            Since your blog reference that you're trying to follow makes use of only Delegated permissions, I think you should be good with option 1 but you can decide further based on your requirements.

            Source https://stackoverflow.com/questions/54927098

            QUESTION

            whitelist AAD login endpoint
            Asked 2017-May-26 at 03:07

            We have a SPA which authenticates using ADAL (similar to examples provided https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp). Now we want to host our application inside a secure environment where all communication outside is blocked by default. So we want to whitelist IP addresses which are/can be associated with AAD login process.

            Using DNS lookup to find IP addresses for login.microsoftonline.com doesn't give me all the IPs since I did nslookup from different location and found different set. So, wondering do you guys know a set of such IPs.

            PS: I found a list of IPs here - https://docs.microsoft.com/en-us/azure/active-directory/connect/active-directory-aadconnect-prerequisites but this list is huge. Do I need to whitelist all?

            ...

            ANSWER

            Answered 2017-May-26 at 03:07

            Yes, you should whitelist all IPs in the Office 365 URLs and IP address ranges - Identity and Authentication documentation.

            This list is so big because Azure AD is a globally available service and thus is deployed across the world in order to meet its availability and performance SLAs. Also worth mentioning is that Azure AD is comprised of many different services (Auth, MFA, Azure AD Connect, etc) which have their own IP addresses.

            Lastly, don't forget to also add the IP address of any federation server(s) if the Azure AD tenant is federated (this is generally ADFS). This last point is particularly challenging if your applications is a multitenant application.

            Source https://stackoverflow.com/questions/44170612

            QUESTION

            401 Unauthorized errors when accessing WebApI from AngularJS/ADAL.js client
            Asked 2017-Mar-14 at 16:01

            I've got a self-hosted web api application with an angular front end, and I need to now start authenticating users via Azure Active Directory.

            I've downloaded the SinglePageApp example and I've set this up and have it running successfully. https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp-dotnet-webapi

            When applying the necessary changes to my own app, I can successfully redirect the user to the Azure login screen and get back the userProfile using adal.js/adal_angular.js. I'm getting 401 unauthorized errors whenever I call my API, however using Fiddler, I can see that the bearer token is added to the HTTP header in each call.

            Here is my AdalAngular setup:

            ...

            ANSWER

            Answered 2017-Mar-14 at 16:01

            You need to declare the ConfigureAuth(appBuilder); as the first line in the Startup.cs Configuration method. You can find a good explanation here on why it need to be declared as the first.

            Source https://stackoverflow.com/questions/42710362

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install active-directory-angularjs-singlepageapp

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/Azure-Samples/active-directory-angularjs-singlepageapp.git

          • CLI

            gh repo clone Azure-Samples/active-directory-angularjs-singlepageapp

          • sshUrl

            git@github.com:Azure-Samples/active-directory-angularjs-singlepageapp.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link