Copy of ng2-adal-QuickStart implemented with angular-cli
. Adal library used: ng2-adal
ADAL.JS (adal-angular) version is implemented on adaljs branch.
Angular 4.0 version is implemented on angular4.0 branch. Using deprecated HttpModule
.
This project was generated with Angular CLI version 1.5.
Go to .\src\app\_services\
and replace adal-config.service.ts.template
with adal-config.service.ts
and your actual values.
Run
npm install
ng serve -o
/home
- main page with Login/Logout buttons/restricted
- a protected withAuthenticationGuard.canActivate
/unauthorized
- user will be redirected here when tries to access/restricted
route but is not logged-in. Use Login button first on/home
page./auth-callback
- here Azure AD will redirect after successful login/logout process. It must be configured in Azure portal in Reply URLs section and insecret.service.ts
asredirectUri
andpostLogoutRedirectUri
.
Set environment variable on your local machine ASPNETCORE_ENVIRONMENT=Development
Update appsettings.json
and set
"MicrosoftIdentity": {
"Authority": "https://login.microsoftonline.com/{tenantId}",
"ClientId": "YOUR CLIENT ID"
}
or alternatively set it in user-secrets
(Secret Manager) for the project
Run
dotnet restore
.\run-server.cmd
The run-server.cmd
is used to run the app on :44008 port.
Left Menu -> Azure Active Directory -> App registrations -> Select your AD app
Your AD app -> All settings -> Reply URLs
Set http://localhost:4200/auth-callback
Your AD app -> All settings -> Application ID
Your AD app -> Manifest
Set oauth2AllowImplicitFlow
to true