<commit_before>import { OpaqueToken } from "@angular/core";
import { NgModule, Inject, Optional } from '@angular/core';
import { HttpModule } from '@angular/http';
import { AuthModule, OidcSecurityService, OpenIDImplicitFlowConfiguration } from 'angular-auth-oidc-client';

export const PICTUREPARK_AUTH_CONFIG = new OpaqueToken('PICTUREPARK_AUTH_CONFIG');

export interface IPictureparkAuthConfig {
  stsServer: string;
  redirectUrl?: string;
}

import {
  JsonSchemaService,
  ContentService,
  BusinessProcessService,
  DocumentHistoryService,
  SchemaService,
  UserService,
  PermissionService,
  PublicAccessService,
  ShareService,
  TransferService,
  AuthService
} from './picturepark.services';

@NgModule({
  imports: [
    HttpModule
  ],
  providers: [
    JsonSchemaService,
    ContentService,
    BusinessProcessService,
    DocumentHistoryService,
    SchemaService,
    UserService,
    PermissionService,
    PublicAccessService,
    ShareService,
    TransferService,
    AuthService]
})
export class PictureparkModule {
}

@NgModule({
  imports: [
    HttpModule,
    PictureparkModule,
    AuthModule.forRoot()
  ]
})
export class PictureparkOidcModule {
  constructor(
    @Inject(OidcSecurityService) oidcSecurityService: OidcSecurityService,
    @Inject(PICTUREPARK_AUTH_CONFIG) pictureparkAuthConfig: IPictureparkAuthConfig) {

    let configuration = new OpenIDImplicitFlowConfiguration();
    configuration.stsServer = pictureparkAuthConfig.stsServer;
    configuration.redirect_url = pictureparkAuthConfig.redirectUrl ? pictureparkAuthConfig.redirectUrl : window.location.origin;
    configuration.client_id = 'picturepark_frontend';
    configuration.response_type = 'id_token token';
    configuration.scope = 'offline_access profile picturepark_api picturepark_account openid';
    configuration.post_logout_redirect_uri = 'http://localhost:56980/login';
    configuration.startup_route = '/login';
    configuration.forbidden_route = '/Forbidden';
    configuration.unauthorized_route = '/Unauthorized';
    configuration.log_console_warning_active = true;
    configuration.log_console_debug_active = false;
    configuration.max_id_token_iat_offset_allowed_in_seconds = 10;
    configuration.override_well_known_configuration = false; 
    configuration.storage = localStorage;

    oidcSecurityService.setupModule(configuration);

    if (typeof location !== "undefined" && window.location.hash) {
      oidcSecurityService.authorizedCallback();
    }<commit_msg>Remove token data from URL<commit_after>import { OpaqueToken } from "@angular/core";
import { NgModule, Inject, Optional } from '@angular/core';
import { HttpModule } from '@angular/http';
import { AuthModule, OidcSecurityService, OpenIDImplicitFlowConfiguration } from 'angular-auth-oidc-client';

export const PICTUREPARK_AUTH_CONFIG = new OpaqueToken('PICTUREPARK_AUTH_CONFIG');

export interface IPictureparkAuthConfig {
  stsServer: string;
  redirectUrl?: string;
}

import {
  JsonSchemaService,
  ContentService,
  BusinessProcessService,
  DocumentHistoryService,
  SchemaService,
  UserService,
  PermissionService,
  PublicAccessService,
  ShareService,
  TransferService,
  AuthService
} from './picturepark.services';

@NgModule({
  imports: [
    HttpModule
  ],
  providers: [
    JsonSchemaService,
    ContentService,
    BusinessProcessService,
    DocumentHistoryService,
    SchemaService,
    UserService,
    PermissionService,
    PublicAccessService,
    ShareService,
    TransferService,
    AuthService]
})
export class PictureparkModule {
}

@NgModule({
  imports: [
    HttpModule,
    PictureparkModule,
    AuthModule.forRoot()
  ]
})
export class PictureparkOidcModule {
  constructor(
    @Inject(OidcSecurityService) oidcSecurityService: OidcSecurityService,
    @Inject(PICTUREPARK_AUTH_CONFIG) pictureparkAuthConfig: IPictureparkAuthConfig) {

    let configuration = new OpenIDImplicitFlowConfiguration();
    configuration.stsServer = pictureparkAuthConfig.stsServer;
    configuration.redirect_url = pictureparkAuthConfig.redirectUrl ? pictureparkAuthConfig.redirectUrl : window.location.origin;
    configuration.client_id = 'picturepark_frontend';
    configuration.response_type = 'id_token token';
    configuration.scope = 'offline_access profile picturepark_api picturepark_account openid';
    configuration.post_logout_redirect_uri = 'http://localhost:56980/login';
    configuration.startup_route = '/login';
    configuration.forbidden_route = '/Forbidden';
    configuration.unauthorized_route = '/Unauthorized';
    configuration.log_console_warning_active = true;
    configuration.log_console_debug_active = false;
    configuration.max_id_token_iat_offset_allowed_in_seconds = 10;
    configuration.override_well_known_configuration = false;
    configuration.storage = localStorage;

    oidcSecurityService.setupModule(configuration);

    if (typeof location !== "undefined" && window.location.hash) {
      oidcSecurityService.authorizedCallback();

      if (window.history.replaceState) {
        window.history.replaceState("", "", "/");
      }
    }
{'fraction_non_alphanumeric': 0.08724569640062597, 'fraction_numerical': 0.0027386541471048514, 'mean_word_length': 5.094159713945173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '933494', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1423, 'n_words': 257}