-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
86 changed files
with
1,439 additions
and
1,439 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 13 additions & 13 deletions
26
...AngularCliAzureAD/certs/dev_localhost.key → ...liMicrsoftEntraID/certs/dev_localhost.key
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIICXQIBAAKBgQCs7HI0KWqXEjH1fxXdkgVHg+1UgbtBhwkeZ3WhBsTGcwlqGUmzqlhKiR2hTd9G | ||
dMhQm1tFeU9qAMpmglxR+XgoZoEv9uoXw/TeegdKvn1V3exTxeULIDGJOXK6wQ1M+4FLMr7zBWlM | ||
hWmqcbYTHHVwwYd+ycDRHU3NAIxDfMUSQQIDAQABAoGAIB8z/7iJ0lJQ8XeQCj6ruGMrXP1UWZHK | ||
AdnaIfVt7CdGYm0cIcHM8NuTo3khtqbO5xpU1Az60YggEPa6S4f558kGBIg4PQVxgE/Kv77ptGAk | ||
rZG9FaCyIibGMh5aJLtxG0Fh1FGnuK1Xk1BKXtaGRUkZpKGg4rMJ9w3qp/T5vLkCQQDe+FiMqY2s | ||
pxHEz+h3NJ0H2T81FCx2upf1fjTVtlQnJ7Gds6eZT0zwa3z1bSw+VkxICERY8C43bzPUJUgPIyLX | ||
AkEAxooyVkJHmxlcIvZfrZPvQs+2GOXpWVnyjNUWf8t9G2MsmkdGIkp7oJhi5obpdNR+3jQe0xyr | ||
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| ||
sAdDQVVb9yrEthm85hpDxbbiNohppzpY/nqeEfkCQQDInS/pP5dYTUxFV+/YweK+6smN2v+dYZAi | ||
5KShWRl5fwpl+mdJT3aziRb/kfYkhGPQMO06OnGzjNKt7Rg0Z8mD | ||
-----END RSA PRIVATE KEY----- |
26 changes: 13 additions & 13 deletions
26
...AngularCliAzureAD/certs/dev_localhost.pem → ...liMicrsoftEntraID/certs/dev_localhost.pem
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICQDCCAamgAwIBAgIJAIKGapdMCt4NMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNVBAMTCWxvY2Fs | ||
aG9zdDAeFw0yMDAyMjAyMjU3MjFaFw0zMDAyMjEyMjU3MjFaMBQxEjAQBgNVBAMTCWxvY2FsaG9z | ||
dDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArOxyNClqlxIx9X8V3ZIFR4PtVIG7QYcJHmd1 | ||
oQbExnMJahlJs6pYSokdoU3fRnTIUJtbRXlPagDKZoJcUfl4KGaBL/bqF8P03noHSr59Vd3sU8Xl | ||
CyAxiTlyusENTPuBSzK+8wVpTIVpqnG2Exx1cMGHfsnA0R1NzQCMQ3zFEkECAwEAAaOBmTCBljAS | ||
BgNVHRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIB/jAUBgNVHREEDTALgglsb2NhbGhvc3Qw | ||
OwYDVR0lBDQwMgYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDAwYIKwYBBQUHAwQGCCsGAQUF | ||
BwMIMB0GA1UdDgQWBBQaVighscgq5k8BjEzeSsZp+6RxITANBgkqhkiG9w0BAQsFAAOBgQBXH/Sq | ||
jekwz+O0eG0zA2MA2LSwt7OELi54vATFYkXO45IO5frRagUTWDkx85/Vfm9OcdfoaHD1UzPkGBU0 | ||
BPsnN3SGCB3Pk5jSRaXIBBiqByDFiP+G6EYmUYhLxB3FpJp6S5KlnQtdtLkl3KuT8KBtc9haro+e | ||
lDlUx5s/FM3SJw== | ||
-----END CERTIFICATE----- | ||
-----BEGIN CERTIFICATE----- | ||
MIICQDCCAamgAwIBAgIJAIKGapdMCt4NMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNVBAMTCWxvY2Fs | ||
aG9zdDAeFw0yMDAyMjAyMjU3MjFaFw0zMDAyMjEyMjU3MjFaMBQxEjAQBgNVBAMTCWxvY2FsaG9z | ||
dDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArOxyNClqlxIx9X8V3ZIFR4PtVIG7QYcJHmd1 | ||
oQbExnMJahlJs6pYSokdoU3fRnTIUJtbRXlPagDKZoJcUfl4KGaBL/bqF8P03noHSr59Vd3sU8Xl | ||
CyAxiTlyusENTPuBSzK+8wVpTIVpqnG2Exx1cMGHfsnA0R1NzQCMQ3zFEkECAwEAAaOBmTCBljAS | ||
BgNVHRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIB/jAUBgNVHREEDTALgglsb2NhbGhvc3Qw | ||
OwYDVR0lBDQwMgYIKwYBBQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDAwYIKwYBBQUHAwQGCCsGAQUF | ||
BwMIMB0GA1UdDgQWBBQaVighscgq5k8BjEzeSsZp+6RxITANBgkqhkiG9w0BAQsFAAOBgQBXH/Sq | ||
jekwz+O0eG0zA2MA2LSwt7OELi54vATFYkXO45IO5frRagUTWDkx85/Vfm9OcdfoaHD1UzPkGBU0 | ||
BPsnN3SGCB3Pk5jSRaXIBBiqByDFiP+G6EYmUYhLxB3FpJp6S5KlnQtdtLkl3KuT8KBtc9haro+e | ||
lDlUx5s/FM3SJw== | ||
-----END CERTIFICATE----- |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 18 additions & 18 deletions
36
...ngularCliAzureAD/src/app/app.component.ts → ...iMicrsoftEntraID/src/app/app.component.ts
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { AuthService } from './auth.service'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: 'app.component.html', | ||
}) | ||
export class AppComponent implements OnInit { | ||
constructor(public authService: AuthService) {} | ||
|
||
ngOnInit() { | ||
this.authService | ||
.checkAuth() | ||
.subscribe((isAuthenticated) => | ||
console.log('app authenticated', isAuthenticated) | ||
); | ||
} | ||
} | ||
import { Component, OnInit } from '@angular/core'; | ||
import { AuthService } from './auth.service'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: 'app.component.html', | ||
}) | ||
export class AppComponent implements OnInit { | ||
constructor(public authService: AuthService) {} | ||
|
||
ngOnInit() { | ||
this.authService | ||
.checkAuth() | ||
.subscribe((isAuthenticated) => | ||
console.log('app authenticated', isAuthenticated) | ||
); | ||
} | ||
} |
134 changes: 67 additions & 67 deletions
134
...s/AngularCliAzureAD/src/app/app.module.ts → ...rCliMicrsoftEntraID/src/app/app.module.ts
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 |
---|---|---|
@@ -1,67 +1,67 @@ | ||
import { DirectApiCallComponent } from './directApiCall/directApiCall.component'; | ||
import { APP_INITIALIZER, NgModule } from '@angular/core'; | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { RouterModule } from '@angular/router'; | ||
import { AuthModule, OidcConfigService, LogLevel } from 'angular-auth-oidc-client'; | ||
import { AppComponent } from './app.component'; | ||
import { HomeComponent } from './home/home.component'; | ||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; | ||
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; | ||
import { AuthInterceptor } from './auth.interceptor'; | ||
import { NavMenuComponent } from './nav-menu/nav-menu.component'; | ||
import { GraphApiCallComponent } from './graphApiCall/graphApiCall.component'; | ||
import { ApplicationApiCallComponent } from './applicationApiCall/applicationApiCall.component'; | ||
import { DelegatedApiCallComponent } from './delegatedApiCall/delegatedApiCall.component'; | ||
import { AuthorizationGuard } from './authorization.guard'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
AppComponent, | ||
HomeComponent, | ||
NavMenuComponent, | ||
UnauthorizedComponent, | ||
DirectApiCallComponent, | ||
GraphApiCallComponent, | ||
ApplicationApiCallComponent, | ||
DelegatedApiCallComponent | ||
], | ||
imports: [ | ||
BrowserModule, | ||
RouterModule.forRoot([ | ||
{ path: '', redirectTo: 'home', pathMatch: 'full' }, | ||
{ path: 'home', component: HomeComponent }, | ||
{ path: 'directApiCall', component: DirectApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'graphApiCall', component: GraphApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'applicationApiCall', component: ApplicationApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'delegatedApiCall', component: DelegatedApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'unauthorized', component: UnauthorizedComponent }, | ||
], { relativeLinkResolution: 'legacy' }), | ||
AuthModule.forRoot({ | ||
config: { | ||
authority: 'https://login.microsoftonline.com/7ff95b15-dc21-4ba6-bc92-824856578fc1/v2.0', | ||
authWellknownEndpointUrl: 'https://login.microsoftonline.com/7ff95b15-dc21-4ba6-bc92-824856578fc1/v2.0', | ||
redirectUrl: window.location.origin, | ||
clientId: 'ad6b0351-92b4-4ee9-ac8d-3e76e5fd1c67', | ||
scope: 'openid profile email api://2b50a014-f353-4c10-aace-024f19a55569/access_as_user offline_access', | ||
responseType: 'code', | ||
silentRenew: true, | ||
useRefreshToken: true, | ||
maxIdTokenIatOffsetAllowedInSeconds: 600, | ||
issValidationOff: false, | ||
autoUserInfo: false, | ||
logLevel: LogLevel.Debug | ||
}, | ||
}), | ||
HttpClientModule, | ||
], | ||
providers: [ | ||
{ | ||
provide: HTTP_INTERCEPTORS, | ||
useClass: AuthInterceptor, | ||
multi: true, | ||
}, | ||
AuthorizationGuard | ||
], | ||
bootstrap: [AppComponent], | ||
}) | ||
export class AppModule {} | ||
import { DirectApiCallComponent } from './directApiCall/directApiCall.component'; | ||
import { APP_INITIALIZER, NgModule } from '@angular/core'; | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { RouterModule } from '@angular/router'; | ||
import { AuthModule, OidcConfigService, LogLevel } from 'angular-auth-oidc-client'; | ||
import { AppComponent } from './app.component'; | ||
import { HomeComponent } from './home/home.component'; | ||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component'; | ||
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; | ||
import { AuthInterceptor } from './auth.interceptor'; | ||
import { NavMenuComponent } from './nav-menu/nav-menu.component'; | ||
import { GraphApiCallComponent } from './graphApiCall/graphApiCall.component'; | ||
import { ApplicationApiCallComponent } from './applicationApiCall/applicationApiCall.component'; | ||
import { DelegatedApiCallComponent } from './delegatedApiCall/delegatedApiCall.component'; | ||
import { AuthorizationGuard } from './authorization.guard'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
AppComponent, | ||
HomeComponent, | ||
NavMenuComponent, | ||
UnauthorizedComponent, | ||
DirectApiCallComponent, | ||
GraphApiCallComponent, | ||
ApplicationApiCallComponent, | ||
DelegatedApiCallComponent | ||
], | ||
imports: [ | ||
BrowserModule, | ||
RouterModule.forRoot([ | ||
{ path: '', redirectTo: 'home', pathMatch: 'full' }, | ||
{ path: 'home', component: HomeComponent }, | ||
{ path: 'directApiCall', component: DirectApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'graphApiCall', component: GraphApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'applicationApiCall', component: ApplicationApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'delegatedApiCall', component: DelegatedApiCallComponent, canActivate: [AuthorizationGuard] }, | ||
{ path: 'unauthorized', component: UnauthorizedComponent }, | ||
], { relativeLinkResolution: 'legacy' }), | ||
AuthModule.forRoot({ | ||
config: { | ||
authority: 'https://login.microsoftonline.com/7ff95b15-dc21-4ba6-bc92-824856578fc1/v2.0', | ||
authWellknownEndpointUrl: 'https://login.microsoftonline.com/7ff95b15-dc21-4ba6-bc92-824856578fc1/v2.0', | ||
redirectUrl: window.location.origin, | ||
clientId: 'ad6b0351-92b4-4ee9-ac8d-3e76e5fd1c67', | ||
scope: 'openid profile email api://2b50a014-f353-4c10-aace-024f19a55569/access_as_user offline_access', | ||
responseType: 'code', | ||
silentRenew: true, | ||
useRefreshToken: true, | ||
maxIdTokenIatOffsetAllowedInSeconds: 600, | ||
issValidationOff: false, | ||
autoUserInfo: false, | ||
logLevel: LogLevel.Debug | ||
}, | ||
}), | ||
HttpClientModule, | ||
], | ||
providers: [ | ||
{ | ||
provide: HTTP_INTERCEPTORS, | ||
useClass: AuthInterceptor, | ||
multi: true, | ||
}, | ||
AuthorizationGuard | ||
], | ||
bootstrap: [AppComponent], | ||
}) | ||
export class AppModule {} |
File renamed without changes.
50 changes: 25 additions & 25 deletions
50
...ApiCall/applicationApiCall.component.html → ...ApiCall/applicationApiCall.component.html
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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
|
||
|
||
|
||
<div *ngIf="isAuthenticated$ | async as isAuthenticated"> | ||
|
||
<button class="btn btn-primary" type="button" (click)="callApi()" [disabled]="httpRequestRunning"> | ||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" [hidden]="!httpRequestRunning" ></span> | ||
Request Data | ||
</button> | ||
|
||
<br/><br/> | ||
|
||
Is Authenticated: {{ isAuthenticated.isAuthenticated }} | ||
|
||
<br/><br/> | ||
|
||
<div class="card"> | ||
<div class="card-header">Data from API using an Application API</div> | ||
<div class="card-body"> | ||
<pre>{{ dataFromAzureProtectedApi$ | async | json }}</pre> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
|
||
<div *ngIf="isAuthenticated$ | async as isAuthenticated"> | ||
|
||
<button class="btn btn-primary" type="button" (click)="callApi()" [disabled]="httpRequestRunning"> | ||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" [hidden]="!httpRequestRunning" ></span> | ||
Request Data | ||
</button> | ||
|
||
<br/><br/> | ||
|
||
Is Authenticated: {{ isAuthenticated.isAuthenticated }} | ||
|
||
<br/><br/> | ||
|
||
<div class="card"> | ||
<div class="card-header">Data from API using an Application API</div> | ||
<div class="card-body"> | ||
<pre>{{ dataFromAzureProtectedApi$ | async | json }}</pre> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
64 changes: 32 additions & 32 deletions
64
...onApiCall/applicationApiCall.component.ts → ...onApiCall/applicationApiCall.component.ts
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Component, OnInit } from '@angular/core'; | ||
import { AuthenticatedResult } from 'angular-auth-oidc-client'; | ||
import { Observable } from 'rxjs'; | ||
import { finalize } from 'rxjs/operators'; | ||
import { AuthService } from '../auth.service'; | ||
|
||
@Component({ | ||
selector: 'app-application-api-call', | ||
templateUrl: 'applicationApiCall.component.html', | ||
}) | ||
export class ApplicationApiCallComponent implements OnInit { | ||
userData$: Observable<any>; | ||
dataFromAzureProtectedApi$: Observable<any>; | ||
isAuthenticated$: Observable<AuthenticatedResult>; | ||
httpRequestRunning = false; | ||
constructor( | ||
private authService: AuthService, | ||
private httpClient: HttpClient | ||
) {} | ||
|
||
ngOnInit() { | ||
this.userData$ = this.authService.userData$; | ||
this.isAuthenticated$ = this.authService.signedIn$; | ||
} | ||
callApi() { | ||
this.httpRequestRunning = true; | ||
this.dataFromAzureProtectedApi$ = this.httpClient | ||
.get('https://localhost:44390/ServiceApiCalls') | ||
.pipe(finalize(() => (this.httpRequestRunning = false))); | ||
} | ||
} | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Component, OnInit } from '@angular/core'; | ||
import { AuthenticatedResult } from 'angular-auth-oidc-client'; | ||
import { Observable } from 'rxjs'; | ||
import { finalize } from 'rxjs/operators'; | ||
import { AuthService } from '../auth.service'; | ||
|
||
@Component({ | ||
selector: 'app-application-api-call', | ||
templateUrl: 'applicationApiCall.component.html', | ||
}) | ||
export class ApplicationApiCallComponent implements OnInit { | ||
userData$: Observable<any>; | ||
dataFromAzureProtectedApi$: Observable<any>; | ||
isAuthenticated$: Observable<AuthenticatedResult>; | ||
httpRequestRunning = false; | ||
constructor( | ||
private authService: AuthService, | ||
private httpClient: HttpClient | ||
) {} | ||
|
||
ngOnInit() { | ||
this.userData$ = this.authService.userData$; | ||
this.isAuthenticated$ = this.authService.signedIn$; | ||
} | ||
callApi() { | ||
this.httpRequestRunning = true; | ||
this.dataFromAzureProtectedApi$ = this.httpClient | ||
.get('https://localhost:44390/ServiceApiCalls') | ||
.pipe(finalize(() => (this.httpRequestRunning = false))); | ||
} | ||
} |
Oops, something went wrong.