-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into axios-validate-status
- Loading branch information
Showing
93 changed files
with
16,150 additions
and
294,290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ on: | |
paths-ignore: | ||
- '**.md' | ||
- '**/.vscode/*.json' | ||
- 'samples/**' | ||
|
||
jobs: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: msal-angular E2E Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- master | ||
pull_request: | ||
paths: | ||
- 'lib/msal-angular/**/*' | ||
- 'lib/msal-browser/**/*' | ||
- 'lib/msal-common/**/*' | ||
- 'samples/msal-angular-v2-samples/**/*' | ||
- '!**.md' | ||
- '.github/workflows/msal-angular-e2e.yml' | ||
|
||
jobs: | ||
run-e2e: | ||
if: (github.repository == 'AzureAD/microsoft-authentication-library-for-js') && ((github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push')) | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
sample: | ||
- 'angular9-v2-sample-app' | ||
- 'angular10-sample-app' | ||
- 'angular11-b2c-sample' | ||
- 'angular11-sample-app' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
|
||
- name: Clean Install | ||
env: | ||
RUNNING_NODE_CI: 1 | ||
run: npm ci | ||
|
||
- name: Build packages | ||
working-directory: lib/msal-angular | ||
run: npm run build:all | ||
|
||
- name: Install Test Tools | ||
working-directory: samples/msal-angular-v2-samples | ||
run: npm install | ||
|
||
- name: Install ${{ matrix.sample }} | ||
working-directory: samples/msal-angular-v2-samples/${{ matrix.sample }} | ||
run: | | ||
npm install | ||
- name: Build ${{ matrix.sample }} | ||
working-directory: samples/msal-angular-v2-samples/${{ matrix.sample }} | ||
run: npm run build | ||
|
||
- name: E2E Tests | ||
working-directory: samples/msal-angular-v2-samples/${{ matrix.sample }} | ||
timeout-minutes: 5 | ||
env: | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
run: npm run e2e | ||
|
||
- name: Upload E2E Test Screenshots | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: e2e-test-screenshots | ||
path: samples/**/screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: msal-react E2E Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- master | ||
pull_request: | ||
paths: | ||
- 'lib/msal-react/**/*' | ||
- 'lib/msal-browser/**/*' | ||
- 'lib/msal-common/**/*' | ||
- 'samples/msal-react-samples/**/*' | ||
- '!**.md' | ||
- '.github/workflows/msal-react-e2e.yml' | ||
|
||
jobs: | ||
run-e2e: | ||
if: (github.repository == 'AzureAD/microsoft-authentication-library-for-js') && ((github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push')) | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
sample: | ||
- 'react-router-sample' | ||
- 'nextjs-sample' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
|
||
- name: Clean Install | ||
env: | ||
RUNNING_NODE_CI: 1 | ||
run: npm ci | ||
|
||
- name: Build packages | ||
working-directory: lib/msal-react | ||
run: npm run build:all | ||
|
||
- name: Install Test Tools | ||
working-directory: samples/msal-react-samples | ||
run: npm install | ||
|
||
- name: Install ${{ matrix.sample }} | ||
working-directory: samples/msal-react-samples/${{ matrix.sample }} | ||
run: | | ||
npm run install:local | ||
npm install | ||
- name: Build ${{ matrix.sample }} | ||
working-directory: samples/msal-react-samples/${{ matrix.sample }} | ||
run: npm run build | ||
|
||
- name: E2E Tests | ||
working-directory: samples/msal-react-samples/${{ matrix.sample }} | ||
timeout-minutes: 5 | ||
env: | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
run: npm test | ||
|
||
- name: Upload E2E Test Screenshots | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: e2e-test-screenshots | ||
path: samples/**/screenshots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,3 +275,4 @@ samples/**/data/testCache.json | |
samples/**/dist/ | ||
.env | ||
ref/ | ||
.server.pid |
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-angular-116b7d3f-06cb-4f5b-b76c-a789bcbfeb1c.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Update ssoSilent and cors-api documentation (#2971)", | ||
"packageName": "@azure/msal-angular", | ||
"email": "joarroyo@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-angular-f99e033b-afd0-45f3-bd57-5aab6a7f614b.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Msal-angular typedocs and instrumentation (#2863)", | ||
"packageName": "@azure/msal-angular", | ||
"email": "joarroyo@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-browser-e5884f37-1ae3-4065-a8d5-47a30aef99e1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Add instrumentation (#2863)", | ||
"packageName": "@azure/msal-browser", | ||
"email": "joarroyo@microsoft.com", | ||
"dependentChangeType": "none" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-react-147cd373-df6a-4668-a3b4-3f183a5cb08a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Docs updates (#2965)", | ||
"packageName": "@azure/msal-react", | ||
"email": "thomas.norling@microsoft.com", | ||
"dependentChangeType": "none" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@azure-msal-react-74f94a66-4b2f-454c-bb40-c4d0a8608743.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "package-lock updates (#2841)", | ||
"packageName": "@azure/msal-react", | ||
"email": "thomas.norling@microsoft.com", | ||
"dependentChangeType": "none" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Silent login with ssoSilent() | ||
|
||
If you already have a session that exists with the authentication server, you can use the `ssoSilent()` API to make a request for tokens without interaction. | ||
You will need to pass a `loginHint` in the request object in order to successfully obtain a token silently. The `loginHint` can be retrieved from the account object `username` property or the `upn` claim in the ID token, and can also be retrieved from the `emails` claim for B2C use cases. Alternatively, `sid` can be passed instead of `loginHint` for AAD use cases. | ||
|
||
```js | ||
const silentRequest: SsoSilentRequest = { | ||
scopes: ["User.Read", "Mail.Read"], | ||
loginHint: "user@contoso.com" | ||
}; | ||
|
||
this.authService.ssoSilent(silentRequest) | ||
.subscribe({ | ||
next: (result) => console.log("Success!"), // Handle result | ||
error: (error) => console.log(error) // Handle error | ||
}); | ||
``` | ||
|
||
If ssoSilent() fails, we recommend handling this error by logging in interactively. Here is an example of ssoSilent() being used in an application's `app.component.ts`: | ||
|
||
```js | ||
import { Component, OnInit } from '@angular/core'; | ||
import { MsalService } from '@azure/msal-angular'; | ||
import { SilentRequest, SsoSilentRequest } from '@azure/msal-browser'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
}) | ||
export class AppComponent implements OnInit { | ||
|
||
constructor( | ||
private authService: MsalService, | ||
) {} | ||
|
||
ngOnInit(): void { | ||
const silentRequest: SsoSilentRequest = { | ||
scopes: ["User.Read"], | ||
loginHint: "user@contoso.com" | ||
} | ||
|
||
this.authService.ssoSilent(silentRequest) | ||
.subscribe({ | ||
next: (result: AuthenticationResult) => { | ||
console.log("SsoSilent succeeded!"); // Handle result | ||
}, | ||
error: (error) => { | ||
this.authService.loginRedirect(); // Handle error by logging in interactively | ||
} | ||
}); | ||
} | ||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.