Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change msal-angular to output es5, fixing compatibility with IE11 #868

Merged
merged 3 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,5 @@ lib-commonjs/
lib-es6/
lib/msal-core/lib-commonjs
lib/msal-core/lib-es6
*.tgz
*.zip
1 change: 1 addition & 0 deletions lib/msal-angular/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Thumbs.db
/src/*/__build__/
__build__/**
.webpack.json
dist


# IDE #
Expand Down
1 change: 1 addition & 0 deletions lib/msal-angular/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
26 changes: 23 additions & 3 deletions lib/msal-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Besides the required clientID, you can optionally pass the following config opti
redirectUri: "http://localhost:4200/",
validateAuthority : true,
cacheLocation : "localStorage",
storeAuthStateInCookie: false, // dynamically set to true when IE11
postLogoutRedirectUri: "http://localhost:4200/",
navigateToLoginRequestUrl : true,
popUp: true,
Expand Down Expand Up @@ -165,6 +166,8 @@ Defaults to `window.location.href`.

* **cacheLocation** : Sets browser storage to either `localStorage` or `sessionStorage`. Defaults to `sessionStorage`.

* **storeAuthStateInCookie** : Stores auth state in a browser cookie instead of local storage. Needs to be set to true when a user is on IE11, which may clear local storage contents when redirecting between websites in different zones. Defaults is `false`.

* **postLogoutRedirectUri** : Redirects the user to postLogoutRedirectUri after logout. Defaults is 'redirectUri'.

* **loadFrameTimeout** : The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Default is 6 seconds.
Expand Down Expand Up @@ -246,10 +249,27 @@ export const protectedResourceMap:[string, string[]][]=[ ['https://buildtodoserv

In your API project, you need to enable CORS API requests to receive flight requests.

> Note: The Iframe needs to access the cookies for the same domain that you did the initial sign in on. IE does not allow to access cookies in Iframe for localhost. Your URL needs to be fully qualified domain i.e http://yoursite.azurewebsites.com. Chrome does not have this restriction.
#### Internet Explorer support

This library supports Internet Explorer 11 with the following configuration:

- For CORS API calls, the Iframe needs to access the cookies for the same domain that you did the initial sign in on. IE does not allow to access cookies in Iframe for localhost. Your URL needs to be fully qualified domain i.e http://yoursite.azurewebsites.com. Chrome does not have this restriction.
- If you put your site in the trusted site list, cookies are not accessible for Iframe requests. You need to remove protected mode for Internet zone or add the authority URL for the login to the trusted sites as well.
- IE may clear local storage when navigating between websites in different zones (e.g. your app and the login authority), which results in a broken experience when returning from the login page. To fix, set `storeAuthStateInCookie` to `true`.
- There are known issues with popups in IE. We recommend using redirect flows by setting `popUp` to `false`.

#### Trusted Site settings in IE
If you put your site in the trusted site list, cookies are not accessible for Iframe requests. You need to remove protected mode for Internet zone or add the authority URL for the login to the trusted sites as well.
It is recommended that these properties are set dynamically based on the user's browser.

```js
const isIE = window.navigator.userAgent.indexOf("MSIE ") > -1 || window.navigator.userAgent.indexOf("Trident/") > -1;

MsalModule.forRoot({
// ...
popUp: !isIE,
storeAuthStateInCookie: ieIE
});

```

## Samples

Expand Down
6 changes: 5 additions & 1 deletion lib/msal-angular/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.4
* Fix msal-angular to transpile for IE11 compatibility: https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/868
* Upgrade to msal-core version 0.2.2, namely including support for `storeAuthStateInCookie` for IE11.

## 0.1.3
* Fix msal-angular exports to properly support IE11: https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/785
* **Note**: Unfortunately, the fix above caused breakage with `aot` compiling, so `0.1.3` has been deprecated in npm. We recommend pinning to `0.1.2` while we work on a fix. See https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/798
Expand All @@ -16,5 +20,5 @@


## 0.1.0
Preview Release
Preview Release

7 changes: 0 additions & 7 deletions lib/msal-angular/dist/AuthenticationResult.d.ts

This file was deleted.

23 changes: 0 additions & 23 deletions lib/msal-angular/dist/AuthenticationResult.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/AuthenticationResult.js.map

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/AuthenticationResult.metadata.json

This file was deleted.

9 changes: 0 additions & 9 deletions lib/msal-angular/dist/MSALError.d.ts

This file was deleted.

33 changes: 0 additions & 33 deletions lib/msal-angular/dist/MSALError.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/MSALError.js.map

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/MSALError.metadata.json

This file was deleted.

15 changes: 0 additions & 15 deletions lib/msal-angular/dist/broadcast.service.d.ts

This file was deleted.

31 changes: 0 additions & 31 deletions lib/msal-angular/dist/broadcast.service.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/broadcast.service.js.map

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/broadcast.service.metadata.json

This file was deleted.

6 changes: 0 additions & 6 deletions lib/msal-angular/dist/index.d.ts

This file was deleted.

7 changes: 0 additions & 7 deletions lib/msal-angular/dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/index.js.map

This file was deleted.

1 change: 0 additions & 1 deletion lib/msal-angular/dist/index.metadata.json

This file was deleted.

Loading