0
export const protectedResourceMap: [string, string[]][] = [
  [environment.api_url, []]
];

const isIE = window.navigator.userAgent.indexOf('MSIE ') > -1 || window.navigator.userAgent.indexOf('Trident/') > -1;
// const protectedResourceMap: [string, string[]][] = [
//   [environment.api_url, []]
// ];

@NgModule({
  declarations: [
    AppComponent,
   ProfileComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule,
    NgbModule,
    NgxSpinnerModule,
    ModalModule.forRoot(),
    RatingModule,
    NgxDaterangepickerMd.forRoot(),
    BlockUIModule.forRoot(),
    BrowserAnimationsModule,
    ToastrModule.forRoot({
      timeOut: 10000,
      maxOpened: 1,
      positionClass: "toast-top-right",
      preventDuplicates: true,
      closeButton: true,
    }),
    MsalModule.forRoot({
      auth: {
        clientId: environment.ida_client_id,
        authority: 'https://login.microsoftonline.com/common/', //+ environment.ida_tenant_id,
        validateAuthority: true,
        redirectUri: 'http://localhost:4200/',
        postLogoutRedirectUri: 'http://localhost:4200/',
        navigateToLoginRequestUrl: false,
      },
      cache: {
        cacheLocation: 'localStorage',
        storeAuthStateInCookie: isIE
      }
    },
    {
      popUp: !isIE,
      consentScopes: [
         'user.read',
         'openid',
         'profile',
        //'api://51a7124f-bc62-436b-8b7e-4c6eeae46f4f/access_as_user'
      ],
      unprotectedResources: ['https://www.microsoft.com/en-us/'],
      protectedResourceMap,
      extraQueryParameters: {}
    })
  ],
  providers: [
    UserService,
    AuthGuard,
    TicketsService,
    NewsService,
    DatePipe,
    BsModalRef,
    EventEmitterService,
    ConfirmedKBArticleService,
    SelfHealingService,
    FeaturesService,
    {
      provide: HTTP_INTERCEPTORS,
      //useClass: CustomHttpInterceptor,
      useClass:MsalInterceptor,
      multi: true,
4

0 回答 0