Configuration File

Prev Next

Configuration File

The Safran API comes with a file where you can adjust and configure the behavior of the Safran API.

application.json

This is the current configuration file for the Safran API.

web.config

This implementation also has a web.config file, and it needs to be left as is.



Here is a sample file of the needed application.json file.

appsettings.json file
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  
  "_comment_connectionStrings": "The name of a connectionstring will be used in JsonWebToken authentication, docs.safran.com/docs/safran-project-integration-api-open-authentication. In case of multiple connectionstrings, requests use parameter 'Connectionstringkey=<connectionstring name>' else 'default' connectionstring will be used",
  "ConnectionStrings": {
      "default": "Data Source=127.0.0.1:1521/SafranDatabase;User Id=SAFRANSA;Password=safran;Max Pool Size=200;",
      "default_mss": "Server=127.0.0.1;Database=SafranDatabase;User Id=SAFRANSA;Password=safran;",
      "default_ora": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=SafranDatabase)));User Id=SAFRANSA;Password=safran;"
  },  },

  "AppSettings": {

    "_comment_SafranWebApiAuthenticationType": "Use 'None' for no authentication, 'JsonWebToken' for Open Authentication (OAuth2.0), 'Basic' for basic database 'user' table authentication, or 'Kerberos' for Kerberos Windows Active Directory authentication",
    "SafranWebApiAuthenticationType": "Insert one from the list above",

    "_comment_SafranWebApiUsers": "domain\\ADgroup or just ADgroup (then users current domain is assumed) Only used for Kerberos Authentiaction",
    "SafranWebApiUsers": "domain\\ADgroup or just ADgroup",

    "_comment_SafranWebAPIOwnerVerificationDuringApiCalls": "Use True to verify that given owner in a API call matches the owner of the project. If the setting is "false", no validation is performed by the API.",
    "SafranWebAPIOwnerVerificationDuringApiCalls": "false",

    "_comment_jsonwebtoken": "This must be populated when using the JsonWebToken option in SafranWebApiAuthenticationType.",
    "jsonwebtoken": {
      "audienceclaim": "Find your AUD and insert it here, see Validate Token section in Microsoft itentity Platform, Verification in docs.safran.com/docs/safran-project-integration-api-microsoft-identiy-platform-verification",
      "issuer": "Same as audienceclaim, found easiest by decrypting a valid token"
    },

    "_comment_License": "Section includes the license keys and folder location.",
    "License": {
      "_comment_License": "Add the lisence for Safran Integration API / Safran Reporting API. Remember to give 'IIS_IUSRS' or 'USERS' access to the file location, or API will result in an failure. docs.safran.com/docs/safran-project-integration-api-license ",
        "safranintegrationapi": "",
        "safrandatareportingapi": "",
        "FileLocation": "c:\\SafranApiLicense\\SafranApiLicense"
    },
    
    "_comment_Compression": "The section includes configuration for compression, using Brotli and Gzip methods.",
    "Compression": {
        "_comment_BrotliCompression": "Optimal, Fastest, NoCompression",
        "_comment_GzipCompression"  : "Optimal, Fastest, NoCompression, SmallestSize",
        "Brotli": "Optimal",
        "Gzip": "SmallestSize"
        },
    
    "_comment_RemoveNullValuesFromTheResult": "The resulting data may contain null values, which are typically included in the JSON result string. You can shorten the result string by removing elements with null values. This can be achieved by setting this option to 'true'. To keep null values set to 'false'",
    "RemoveNullValuesFromTheResult": "true",

  },
  "tracelog": {
    "serilog": {
      "_comment_serilog": "Valid values for serilog: Verbose, Debug, Information, Warning, Error, Fatal. Remember to give 'IIS_IUSRS' or 'USERS' access to the file location.",
      "minimum_level": "Fatal",
      "write_to_file_path": "c:\\temp\\SafranAPI.{Date}.Log.txt"
    },
    "safranlog": {
      "api": "info,call",
      "controller": "info,sql,dbconnection,data",
      "service": "info,sql,dbconnection,data",
      "repositories": "info,sql,dbconnection,data",
      "data": "info,sql,dbconnection,data"
    }
  }
}

web.config

This used to be the configuration file prior moving to .Net Core. This file is no longer used. Your settings need to be moved to the new file “Application.json”. This is only valid for version 7.3 and earlier.


Here is a sample file of the web.config file.

web.config file
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <connectionStrings>
    <add name="default" connectionString="Data Source=OracleTest.64;User ID=safransa;Password=safran" providerName="System.Data.OracleClient" />
    <!--<add name="default" connectionString="Data Source=MSSTest.64;Initial Catalog=SafranDatabase;User ID=safransa;Password=safran" providerName="System.Data.SqlClient" />-->
    
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="SqlCommandTimeOut" value="60" />
    
    <!-- domain\ADgroup or just ADgroup (then users current domain is assumed -->
    <add key="SafranWebApiUsers" value="SafranWebApiUsers" />
    <!-- Use "None" for no authentication, "Basic" for basic database 'user' table authentication, or "Kerberos" for Kerberos Windows Active Directory authentication-->
    <add key="SafranWebApiAuthenticationType" value="None" />
    <!-- Use True to verify that given owner in a API call matches the owner of the network. User False to not use this functionality -->
    <add key="SafranWebAPIOwnerVerificationDuringApiCalls" value="false" />
    
    <!--Valid values for serilog: Verbose, Debug, Information, Warning, Error, Fatal.-->
    <add key="serilog:minimum-level" value="Debug" />
    <add key="serilog:write-to:File.path" value="c:\temp\SafranAPI.{Date}.Log.txt" />
    <!-- Valid values for area: info, sql, dbconnection, data, call -->
    <add key="safranlog.api"          value="info,call" />
    <add key="safranlog.controller"   value="info,sql,dbconnection,data" />
    <add key="safranlog.service"      value="info,sql,dbconnection,data" />
    <add key="safranlog.repositories" value="info,sql,dbconnection,data" />
    <add key="safranlog.data"         value="info,sql,dbconnection,data" />
  </appSettings>
  
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxQueryStringLength="2048" />
    <authentication mode="Windows"></authentication>
  </system.web>
  
  <system.webServer>
    <modules>
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
    </modules>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <security>
       <requestFiltering>
         <requestLimits maxQueryString="2048" />
       </requestFiltering>
    </security>    
  </system.webServer>
  
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>