<commit_before>PROVIDERS = YAML.load_file(Rails.root.join('config', 'providers.yml'))[Rails.env].with_indifferent_access

# Use the system cert store in order to use local certs
Rack::OAuth2.http_config do |http_client|
  http_client.ssl_config.clear_cert_store
  http_client.ssl_config.cert_store.set_default_paths
end

Rails.application.config.middleware.use OmniAuth::Builder do
  #provider :developer unless Rails.env.production?
  # provider :openid_connect, name: :idpp, discovery: true, setup: true
  provider :openid_connect, {
    name:                     :idpp,
    discovery:                true,
    setup:                    true,
    scope:                    [ :openid, :email ],
    
    client_options: {
      host:                   "idp-p.mitre.org",
      identifier:             PROVIDERS[:idpp][:client_id],
      grant_type:             'authorization_code',
      client_assertion_type:  'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
      private_key:            Application.private_key,
      client_auth_method:     "signed_jwt"
    }
  }
end

AUTH_SERVER = AuthorizationServer.new("https://as-va.mitre.org", PROVIDERS[:asva][:client_id])<commit_msg>Removed stray AUTH_SERVER constant.<commit_after>PROVIDERS = YAML.load_file(Rails.root.join('config', 'providers.yml'))[Rails.env].with_indifferent_access

# Use the system cert store in order to use local certs
Rack::OAuth2.http_config do |http_client|
  http_client.ssl_config.clear_cert_store
  http_client.ssl_config.cert_store.set_default_paths
end

Rails.application.config.middleware.use OmniAuth::Builder do
  #provider :developer unless Rails.env.production?
  # provider :openid_connect, name: :idpp, discovery: true, setup: true
  provider :openid_connect, {
    name:                     :idpp,
    discovery:                true,
    setup:                    true,
    scope:                    [ :openid, :email ],
    
    client_options: {
      host:                   "idp-p.mitre.org",
      identifier:             PROVIDERS[:idpp][:client_id],
      grant_type:             'authorization_code',
      client_assertion_type:  'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
      private_key:            Application.private_key,
      client_auth_method:     "signed_jwt"
    }
  }
end
{'fraction_non_alphanumeric': 0.10398613518197573, 'fraction_numerical': 0.0008665511265164644, 'mean_word_length': 2.712218649517685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '4128138', 'n_tokens_mistral': 738, 'n_tokens_neox': 720, 'n_words': 125}