Skip to content

Commit 870c78b

Browse files
authored
MSAL angular and MSAL angularjs wrapper changes
* Correct typo in error message * Na/msal angular (AzureAD#325) * initial commit * moving files * adding folders for wrapper * moving the sample apps inside msal-core * Msal Angular 2 wrapper * adding sample project * msal-core changes for angular 2 wrapper * updated msalservice * cleanup * msal-core latest code changes * adding readme * adding readme * updating msalservice for msal-core changes * latest changes for msal-core * updated package.json * updating package.json and readme * adding getCachedToken_ api * cleanup * adding generated files * adding readme * adding readme * cleanup * cleanup * logger changes * updating readme * callback for redirect flows * updating readme * added angularjs wrapper and devApp * cleanup * cleanup * Updated MSAL angular sample app * updated sample app * updated sample app * updated sample app * adding unsubscription code * updated readme * updated readme * cleanup * updated readme * updated readme for sample app * updating docs * added angularjs wrapper, sample and README * updated readme * read me * readme changes * updated readme * updated README * readme edit * read me changes * edited cors api usage * edited js script tags * merging msal-core from dev branch * update angular sample app * updated angular sample * updated sample app * adding node_modules for ms-msal-angular and msal * updating sample app to use the dummy node_modules * updating the sample app * updated title for sample app * changing config parameter name * updated readme * removing extra comma * updated Travis * updated node_modules * deleted travis.yml from msal-angular * added initial karma tests * updated travis to build msal-core and msal-angular * fixed travis.yml * updated travis build details * adding unit test cases fr msalAngular * adding unit test cases * added chrome headless configuration * Update .travis.yml Fixed Travis.yml * Update .travis.yml fixed Tarvis.yml * updated travis * updated tests to run on vsts * updated karma for vsts integration * updated npm script * adding end to end test cases config files * updated package.json for e2e tests * updating command name for e2e tests * updated logs in e2e test case * updating protractor conf file * updating protractor conf file * updated e2e test config * updated e2e test config * updated e2e test config * updated e2e test config * updated e2e test config * updated e2e test config * updated e2e test config * updated e2e test config * updated e2e test config * added boilerplate to retrieve all keyvault secrets and initialize browserstack * added end to end tests for Msal Angularjs wrapper * Update protractor.conf.chrome.js * updated e2e tests * updating test config * fixed package.json * updated e2e config file * updated test config * updated config * updated config file * updated e2e config files * added jasmine-reporter * added lab details * added webapi test cases for lab * adding code coverage configuration * added test cases for MSA * added test cases for msa * fixed alignment * added msa secrets * added code coverage for msal-core * added test coverage report * added unit tests for msal-core * adding more test cases * updated endtoend tests to use the lab account * updated package.json for msalangularjs e2e * fixed package.json for e2e * changed build name for msalAngularJS * changed spec reporter for karma conf * added 401 code handling in httpInterceptor * added code coverage for angularJS * fixed angularjs build * adding angularjs test cases * added unit tests for angularjs wrapper * update test case * updated karma config * added more unit tests * added unit tests for wrapper api's * updated test cases * updating msal core version * renamed folder * cleanup * cleanup * cleaning up package.json * sample cleanup * end to end sample for msal angularjs * adding end to end test case sample for msal-angular * updated sample for msal angularjs * updated msal angularjs sample * added dist and doc * package.json and gitignore cleanup * updated msal-core with latest changes from dev * updated package.json * fixed test cases * updated msal-angular sample * deleted npm debug file * cleanup * updated readme * cleanup * deleting generated files * updated chaneglog * added details for correlation id in readme * fixing the userCancelledError description * release changes ffor msal angular and angularjs * Clean up of Readmes for msal core, angularjs and angular (AzureAD#362) * Clean up of Readmes for msal core, angularjs and angular - Added contributing guide - Added advanced topics in readmes * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Fixed public apis and renamed config parameters * updated code for msal-core and msal-angularjs * updated msal-angularjs file along with package.json * fixed build error * fixed unit tests * updated package.json * Update changelog.md * Update README.md * Update keyVault.js * adding issue_template.md
1 parent cb00061 commit 870c78b

File tree

551 files changed

+218821
-969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

551 files changed

+218821
-969
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,3 @@ node_modules/
256256
typings/
257257
lib-commonjs/
258258
lib-es6/
259-
dist/

.travis.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
addons:
22
firefox: "latest"
3+
chrome: "stable"
34

45
language: node_js
56

67
node_js:
78
- 'stable'
89

10+
cache:
11+
directories:
12+
- node_modules
13+
914
before_install:
10-
- export DISPLAY=:99.0
11-
- sh -e /etc/init.d/xvfb start
15+
# starting a GUI to run tests, per https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
16+
- export DISPLAY=:99.0
17+
- sh -e /etc/init.d/xvfb start
18+
- sudo chown root /opt/google/chrome/chrome-sandbox
19+
- sudo chmod 4755 /opt/google/chrome/chrome-sandbox
1220

1321
install:
1422
- npm install
1523
- npm install -g karma
16-
- npm install -g typings
24+
- npm install -g typings
25+
26+
27+
#The default build script for projects using nodejs is:
28+
#npm test

README.md

Lines changed: 20 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,46 @@
11

2-
Microsoft Authentication Library Preview for JavaScript (MSAL.js)
2+
Microsoft Authentication Library Preview
33
=========================================================
44

5-
| [Getting Started](https://github.com/Azure-Samples/active-directory-javascript-singlepageapp-dotnet-webapi-v2 )| [Docs](https://aka.ms/aaddevv2) | [Library Reference](https://htmlpreview.github.io/?https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-js/blob/master/docs/classes/_useragentapplication_.useragentapplication.html) | [Support](README.md#community-help-and-support) | [Samples](./devApps/VanillaJSTestApp )
5+
| [Getting Started](https://docs.microsoft.com/en-us/azure/active-directory/develop/guidedsetups/active-directory-javascriptspa)| [Docs](https://aka.ms/aaddevv2) | [Library Reference](https://htmlpreview.github.io/?https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-core/docs/classes/_useragentapplication_.useragentapplication.html) | [Support](README.md#community-help-and-support) | [Samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Samples)
66
| --- | --- | --- | --- | --- |
77

8+
The MSAL library preview for JavaScript enables Single Page Applications to authenticate users with Microsoft Azure Active Directory (AAD) accounts, Microsoft accounts (MSA), accounts in social identity providers like Facebook, Google, LinkedIn etc. and get access to [Microsoft Cloud](https://cloud.microsoft.com) services such as [Microsoft Graph](https://developer.microsoft.com/en-us/graph).
89

9-
The MSAL library preview for JavaScript enables your app to authorize enterprise users using Microsoft Azure Active Directory (AAD), Microsoft account users (MSA), users using social identity providers like Facebook, Google, LinkedIn etc. and get access to [Microsoft Cloud](https://cloud.microsoft.com) OR [Microsoft Graph](https://graph.microsoft.io).
10-
11-
The identity management services that the library interacts with are [Microsoft Azure Active Directory](https://azure.microsoft.com/en-us/services/active-directory/), [Microsoft Azure B2C](https://azure.microsoft.com/services/active-directory-b2c/) and [Microsoft Accounts](https://account.microsoft.com).
10+
The identity management services that the library interacts with are [Microsoft Azure Active Directory](https://azure.microsoft.com/en-us/services/active-directory/), [Microsoft Azure AD B2C](https://azure.microsoft.com/services/active-directory-b2c/) and [Microsoft Accounts](https://account.microsoft.com).
1211

1312

1413
[![Build Status](https://travis-ci.org/AzureAD/microsoft-authentication-library-for-js.png?branch=dev)](https://travis-ci.org/AzureAD/microsoft-authentication-library-for-js)[![npm version](https://img.shields.io/npm/v/msal.svg?style=flat)](https://www.npmjs.com/package/msal)[![npm version](https://img.shields.io/npm/dm/msal.svg)](https://nodei.co/npm/msal/)
1514

1615
## Important Note about the MSAL Preview
1716
This library is suitable for use in a production environment. We provide the same production level support for this library as we do our current production libraries. During the preview we may make changes to the API, internal cache format, and other mechanisms of this library, which you will be required to take along with bug fixes or feature improvements. This may impact your application. For instance, a change to the cache format may impact your users, such as requiring them to sign in again. An API change may require you to update your code. When we provide the General Availability release we will require you to update to the General Availability version within six months, as applications written using a preview version of library may no longer work.
1817

18+
## Libraries
19+
Microsoft Authentication Library provides 3 libraries as separate packages. You can read more details about them in the [MSAL Wiki](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki).
20+
21+
- [Microsoft Authentication Library for JavaScript](lib/msal-core/README.md) :
22+
The core library which can be used in any JavaScript web application.
23+
24+
- [Microsoft Authentication Library for Angular](lib/msal-angular/README.md) :
25+
A wrapper of the core library to support apps using Angular framework.
26+
27+
- [Microsoft Authentication Library for AngularJS](lib/msal-angularjs/README.md) :
28+
A wrapper of the core library to support apps using AngularJS framework.
1929

20-
## Example
21-
This example shows how to acquire a token to read user information from Microsoft Graph.
22-
1. Register an application in Azure AD v2.0 (using the [application registration portal](https://apps.dev.microsoft.com/)) to get your client_id. you will also need to add the Web platform, check the "Implicit Flow" checkbox, and add the redirectURI to your application.
23-
2. Instantiate a UserAgentApplication and login the user:
24-
```JavaScript
25-
<script class="pre">
26-
var applicationConfig = {
27-
clientID: 'your_client_id',
28-
graphScopes: ["user.read", "mail.send"]
29-
};
30-
31-
var logger = new Msal.Logger(loggerCallback, { level: Msal.LogLevel.Verbose, correlationId:'12345' }); // level and correlationId are optional parameters.
32-
//Logger has other optional parameters like piiLoggingEnabled which can be assigned as shown aabove. Please refer to the docs to see the full list and their default values.
33-
34-
function loggerCallback(logLevel, message, piiLoggingEnabled) {
35-
console.log(message);
36-
}
37-
38-
var userAgentApplication = new Msal.UserAgentApplication(applicationConfig.clientID, null, authCallback, { logger: logger, cacheLocation: 'localStorage'}); //logger and cacheLocation are optional parameters.
39-
//userAgentApplication has other optional parameters like redirectUri which can be assigned as shown above.Please refer to the docs to see the full list and their default values.
40-
function authCallback(errorDesc, token, error, tokenType) {
41-
if (token) {
42-
}
43-
else {
44-
log(error + ":" + errorDesc);
45-
}
46-
}
47-
</script>
48-
```
49-
3. Then, once the user is logged-in, get an access token
50-
51-
```JavaScript
52-
<script>
53-
userAgentApplication.loginPopup(applicationConfig.graphScopes).then(function (idToken) {
54-
//Login Success
55-
userAgentApplication.acquireTokenSilent(applicationConfig.graphScopes).then(function (accessToken) {
56-
//AcquireToken Success
57-
}, function (error) {
58-
//AcquireToken Failure, send an interactive request.
59-
userAgentApplication.acquireTokenPopup(applicationConfig.graphScopes).then(function (accessToken) {
60-
updateUI();
61-
}, function (error) {
62-
console.log(error);
63-
});
64-
})
65-
}, function (error) {
66-
console.log(error);
67-
});
68-
</script>
69-
```
70-
71-
4. use the token in an [HTTP bearer request](https://github.com/Azure-Samples/active-directory-javascript-singlepageapp-dotnet-webapi-v2/blob/master/TodoSPA/App/Scripts/Ctrls/todoListCtrl.js#L30), to call the Microsoft Graph or a Web API
72-
73-
## Installation
74-
75-
Via NPM:
76-
77-
npm install msal
78-
79-
Note that msal.js is built for ES5, therefore enabling support of Internet Explorer 11. If you want to target Internet Explorer, you'll need to add a reference to promises polyfill. You might want to read more in the [FAQ](../../wiki)
80-
```JavaScript
81-
<!-- IE support: add promises polyfill before msal.js -->
82-
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js" class="pre"></script>
83-
```
84-
85-
## Build and running tests
86-
87-
If you want to build the library and run all the unit tests, you can do the following.
88-
89-
First navigate to the root directory of the library and install the dependencies:
90-
91-
npm install
92-
93-
Then use the following command to build the library and run all the unit tests:
94-
95-
npm run build
96-
97-
## Logging
98-
99-
You can enable logging in MSAL.js by passing a logger object when creating a UserAgentApplication instance as follows:
100-
```javascript
101-
var logger = new Msal.Logger(loggerCallback, { level: Msal.LogLevel.Verbose });
102-
103-
var clientApplication = new Msal.UserAgentApplication(clientID, authority, authCallback, { logger: logger });
104-
105-
```
106-
Implement the `loggerCallback` method depending on how you want to redirect logs.
107-
The supported log levels are: Error, Warning, Info, Verbose
108-
109-
#### Personal Identifiable Information (PII) & Organizational Identifiable Information (OII)
110-
111-
By default, MSAL.js logging does not capture or log any PII or OII. The library allows app developers to turn this on by configuring the `piiLoggingEnabled` flag on the log context. By turning on PII or OII, the app takes responsibility for safely handling highly-sensitive data and complying with any regulatory requirements.
112-
113-
```javascript
114-
//PII or OII logging disabled. Default Logger does not capture any PII or OII
115-
var logger = new Msal.Logger(loggerCallback, { level: Msal.LogLevel.Verbose, piiLoggingEnabled: false });
116-
117-
//PII or OII logging enabled
118-
var logger = new Msal.Logger(loggerCallback, { level: Msal.LogLevel.Verbose, piiLoggingEnabled: true });
119-
120-
```
12130
## Community Help and Support
12231

123-
- [FAQ](../../wiki) for access to our frequently asked questions
32+
- [FAQs](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/FAQs) for access to our frequently asked questions
12433

125-
- [Stack Overflow](http://stackoverflow.com/questions/tagged/msal) using tag MSAL.
126-
We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
34+
- [Stack Overflow](http://stackoverflow.com/questions/tagged/msal) using "msal" and "msal.js" tag.
35+
We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
12736

128-
- [GitHub Issues](../../issues) for reporting an bug or feature requests
37+
- [GitHub Issues](../../issues) for reporting a bug or feature requests
12938

13039
- [User Voice page](https://feedback.azure.com/forums/169401-azure-active-directory) to provide recommendations and/or feedback
13140

13241
## Contribute
13342

134-
We enthusiastically welcome contributions and feedback. You can clone the repo and start contributing now.
135-
136-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
43+
We enthusiastically welcome contributions and feedback. Please read the [contributing guide](contributing.md) before you begin.
13744

13845
## Security Library
13946

@@ -143,11 +50,6 @@ This library controls how users sign-in and access services. We recommend you al
14350

14451
If you find a security issue with our libraries or services please report it to [[email protected]](mailto:[email protected]) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/en-us/security/dd252948) and subscribing to Security Advisory Alerts.
14552

146-
147-
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License");
148-
149-
150-
15153
## License
15254

15355
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License");

contributing.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# CONTRIBUTING
2+
3+
Azure Active Directory SDK projects welcome new contributors. This document will guide you
4+
through the process.
5+
6+
### CONTRIBUTOR LICENSE AGREEMENT
7+
8+
Please visit [https://cla.microsoft.com/](https://cla.microsoft.com/) and sign the Contributor License
9+
Agreement. You only need to do that once. We can not look at your code until you've submitted this request.
10+
11+
12+
### FORK
13+
14+
Fork the project [on GitHub][] and check out
15+
your copy.
16+
17+
Example for JS:
18+
19+
```
20+
$ git clone [email protected]:username/microsoft-authentication-library-for-js.git
21+
$ cd microsoft-authentication-library-for-js
22+
$ git remote add upstream [email protected]:AzureAD/microsoft-authentication-library-for-js.git
23+
```
24+
25+
Now decide if you want your feature or bug fix to go into the dev branch
26+
or the master branch. **All bug fixes and new features should go into the dev branch.**
27+
28+
The master branch is effectively frozen; patches that change the SDKs
29+
protocols or API surface area or affect the run-time behavior of the SDK will be rejected.
30+
31+
Some of our SDKs have bundled dependencies that are not part of the project proper. Any changes to files in those directories or its subdirectories should be sent to their respective
32+
projects. Do not send your patch to us, we cannot accept it.
33+
34+
In case of doubt, open an issue in the [issue tracker][].
35+
36+
Especially do so if you plan to work on a major change in functionality. Nothing is more
37+
frustrating than seeing your hard work go to waste because your vision
38+
does not align with our goals for the SDK.
39+
40+
41+
### BRANCH
42+
43+
Okay, so you have decided on the proper branch. Create a feature branch
44+
and start hacking:
45+
46+
```
47+
$ git checkout -b my-feature-branch
48+
```
49+
50+
### COMMIT
51+
52+
Make sure git knows your name and email address:
53+
54+
```
55+
$ git config --global user.name "J. Random User"
56+
$ git config --global user.email "[email protected]"
57+
```
58+
59+
Writing good commit logs is important. A commit log should describe what
60+
changed and why. Follow these guidelines when writing one:
61+
62+
1. The first line should be 50 characters or less and contain a short
63+
description of the change prefixed with the name of the changed
64+
subsystem (e.g. "net: add localAddress and localPort to Socket").
65+
2. Keep the second line blank.
66+
3. Wrap all other lines at 72 columns.
67+
68+
A good commit log looks like this:
69+
70+
```
71+
fix: explaining the commit in one line
72+
73+
Body of commit message is a few lines of text, explaining things
74+
in more detail, possibly giving some background about the issue
75+
being fixed, etc etc.
76+
77+
The body of the commit message can be several paragraphs, and
78+
please do proper word-wrap and keep columns shorter than about
79+
72 characters or so. That way `git log` will show things
80+
nicely even when it is indented.
81+
```
82+
83+
The header line should be meaningful; it is what other people see when they
84+
run `git shortlog` or `git log --oneline`.
85+
86+
Check the output of `git log --oneline files_that_you_changed` to find out
87+
what directories your changes touch.
88+
89+
90+
### REBASE
91+
92+
Use `git rebase` (not `git merge`) to sync your work from time to time.
93+
94+
```
95+
$ git fetch upstream
96+
$ git rebase upstream/v0.1 # or upstream/master
97+
```
98+
99+
100+
### TEST
101+
102+
Bug fixes and features should come with tests. Add your tests in the
103+
test directory. This varies by repository but often follows the same convention of /src/test. Look at other tests to see how they should be
104+
structured (license boilerplate, common includes, etc.).
105+
106+
107+
Make sure that all tests pass.
108+
109+
110+
### PUSH
111+
112+
```
113+
$ git push origin my-feature-branch
114+
```
115+
116+
Go to https://github.com/username/microsoft-authentication-library-for-***.git and select your feature branch. Click
117+
the 'Pull Request' button and fill out the form.
118+
119+
Pull requests are usually reviewed within a few days. If there are comments
120+
to address, apply your changes in a separate commit and push that to your
121+
feature branch. Post a comment in the pull request afterwards; GitHub does
122+
not send out notifications when you add commits.
123+
124+
125+
[on GitHub]: https://github.com/AzureAD/microsoft-authentication-library-for-js
126+
[issue tracker]: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues

dist/msal.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)