<commit_before>import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AuthOptions } from './auth-options';
import { AuthStateService } from './authState/auth-state.service';
import { CallbackService } from './callback/callback.service';
import { RefreshSessionService } from './callback/refresh-session.service';
import { CheckAuthService } from './check-auth.service';
import { ConfigurationProvider } from './config/config.provider';
import { OpenIdConfiguration } from './config/openid-configuration';
import { FlowsDataService } from './flows/flows-data.service';
import { CheckSessionService } from './iframe/check-session.service';
import { LoginResponse } from './login/login-response';
import { LoginService } from './login/login.service';
import { PopupOptions } from './login/popup/popup-options';
import { LogoffRevocationService } from './logoffRevoke/logoff-revocation.service';
import { StoragePersistenceService } from './storage/storage-persistence.service';
import { UserService } from './userData/user.service';
import { TokenHelperService } from './utils/tokenHelper/oidc-token-helper.service';

@Injectable()
export class OidcSecurityService {
  /**
   * Provides information about the user after they have logged in.
   */
  get userData$(): Observable<any> {
    return this.userService.userData$;
  }

  /**
   * Emits each time an authorization event occurs. Returns true if the user is authenticated and false if they are not.
   */
  get isAuthenticated$(): Observable<boolean> {
    return this.authStateService.authorized$;
  }

  /**
   * Emits each time the server sends a CheckSession event and the value changed. This property will always return
   * true.
   */
  get checkSessionChanged$(): Observable<boolean> {
    return this.checkSessionService.checkSessionChanged$;
  }

  /**
   * Emits on possible STS callback. The observable will never contain a value.
   */
  get stsCallback$(): Observable<any> {
    return this.callbackService.stsCallback$;
  }

  constructor(
    private checkSessionService: CheckSessionService,
    private checkAuthService: CheckAuthService,
    private userService: UserService,
    private tokenHelperService: TokenHelperService,
    private configurationProvider: ConfigurationProvider,
    private authStateService: AuthStateService,
    private flowsDataService: FlowsDataService,
    private callbackService: CallbackService,
    private logoffRevocationService: LogoffRevocationService,
    private loginService: LoginService,
    private storagePersistenceService: StoragePersistenceService,
    private refreshSessionService: RefreshSessionService
  ) {}

  /**
   * Returns the currently active OpenID configurations.
   *
   * @returns OpenIdConfiguration if only one is active, an array otherwise
   */
  getConfigurations(): OpenIdConfiguration[] {
    return this.configurationProvider.getAllConfigurations();
  }

  /**
   * Returns a single active OpenIdConfiguration.
   *
   * @param uniqueId The uniqueId to identify the config. If not passed, the first one is being returned
   *
   * @returns OpenIdConfiguration if only one is active, an array otherwise
   */
  getConfiguration(configId?: string): OpenIdConfiguration {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.configurationProvider.getOpenIDConfiguration(configId);
  }

  /**
   * Starts the complete setup flow. Calling will start the entire authentication flow, and the returned observable
   * will denote whether the user was successfully authenticated including the user data and the access token
   *
   * @param url The url to perform the authorization on the behalf of.
   */
  checkAuth(url?: string, configId?: string): Observable<LoginResponse> {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.checkAuthService.checkAuth(url, configId);
  }

  /**
   * Checks the server for an authenticated session using the iframe silent renew if not locally authenticated.
   */
  checkAuthIncludingServer(configId?: string): Observable<LoginResponse> {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.checkAuthService.checkAuthIncludingServer(configId);
  }

  /**
   * Returns the access token for the login scenario.
   */
  getToken(configId?: string): string {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.authStateService.getAccessToken(configId);
  }

  /**
   * Returns the ID token for the login scenario.
   */
  getIdToken(configId?: string): string {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.authStateService.getIdToken(configId);
  }
<commit_msg>fixing first error<commit_after>import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AuthOptions } from './auth-options';
import { AuthStateService } from './authState/auth-state.service';
import { CallbackService } from './callback/callback.service';
import { RefreshSessionService } from './callback/refresh-session.service';
import { CheckAuthService } from './check-auth.service';
import { ConfigurationProvider } from './config/config.provider';
import { OpenIdConfiguration } from './config/openid-configuration';
import { FlowsDataService } from './flows/flows-data.service';
import { CheckSessionService } from './iframe/check-session.service';
import { LoginResponse } from './login/login-response';
import { LoginService } from './login/login.service';
import { PopupOptions } from './login/popup/popup-options';
import { LogoffRevocationService } from './logoffRevoke/logoff-revocation.service';
import { StoragePersistenceService } from './storage/storage-persistence.service';
import { UserService } from './userData/user.service';
import { TokenHelperService } from './utils/tokenHelper/oidc-token-helper.service';

@Injectable()
export class OidcSecurityService {
  /**
   * Provides information about the user after they have logged in.
   */
  get userData$(): Observable<any> {
    return this.userService.userData$;
  }

  /**
   * Emits each time an authorization event occurs. Returns true if the user is authenticated and false if they are not.
   */
  get isAuthenticated$(): Observable<boolean> {
    return this.authStateService.authorized$;
  }

  /**
   * Emits each time the server sends a CheckSession event and the value changed. This property will always return
   * true.
   */
  get checkSessionChanged$(): Observable<boolean> {
    return this.checkSessionService.checkSessionChanged$;
  }

  /**
   * Emits on possible STS callback. The observable will never contain a value.
   */
  get stsCallback$(): Observable<any> {
    return this.callbackService.stsCallback$;
  }

  constructor(
    private checkSessionService: CheckSessionService,
    private checkAuthService: CheckAuthService,
    private userService: UserService,
    private tokenHelperService: TokenHelperService,
    private configurationProvider: ConfigurationProvider,
    private authStateService: AuthStateService,
    private flowsDataService: FlowsDataService,
    private callbackService: CallbackService,
    private logoffRevocationService: LogoffRevocationService,
    private loginService: LoginService,
    private storagePersistenceService: StoragePersistenceService,
    private refreshSessionService: RefreshSessionService
  ) {}

  /**
   * Returns the currently active OpenID configurations.
   *
   * @returns OpenIdConfiguration if only one is active, an array otherwise
   */
  getConfigurations(): OpenIdConfiguration[] {
    return this.configurationProvider.getAllConfigurations();
  }

  /**
   * Returns a single active OpenIdConfiguration.
   *
   * @param uniqueId The uniqueId to identify the config. If not passed, the first one is being returned
   *
   * @returns OpenIdConfiguration if only one is active, an array otherwise
   */
  getConfiguration(configId?: string): OpenIdConfiguration {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.configurationProvider.getOpenIDConfiguration(configId);
  }

  /**
   * Starts the complete setup flow. Calling will start the entire authentication flow, and the returned observable
   * will denote whether the user was successfully authenticated including the user data and the access token
   *
   * @param url The url to perform the authorization on the behalf of.
   */
  checkAuth(url?: string, configId?: string): Observable<LoginResponse> {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.checkAuthService.checkAuth(configId, url);
  }

  /**
   * Checks the server for an authenticated session using the iframe silent renew if not locally authenticated.
   */
  checkAuthIncludingServer(configId?: string): Observable<LoginResponse> {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.checkAuthService.checkAuthIncludingServer(configId);
  }

  /**
   * Returns the access token for the login scenario.
   */
  getToken(configId?: string): string {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.authStateService.getAccessToken(configId);
  }

  /**
   * Returns the ID token for the login scenario.
   */
  getIdToken(configId?: string): string {
    configId = configId ?? this.configurationProvider.getOpenIDConfiguration(configId)?.uniqueId;

    return this.authStateService.getIdToken(configId);
  }

{'fraction_non_alphanumeric': 0.09614401145545669, 'fraction_numerical': 0.0, 'mean_word_length': 4.447353760445682, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '16129', 'n_tokens_mistral': 2546, 'n_tokens_neox': 2497, 'n_words': 732}