Basic Authentication
  • 04 Sep 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Basic Authentication

  • Dark
    Light
  • PDF

Article summary

Basic Authentication

Basic authentication uses the database "api_user" table to collect a valid username and password. Be aware that the password is stored in plain text.

Setup

  1. Internet Information Services (IIS)

    1. In your IIS installation, locate and select the Safran Web API Site.
      1. Select the "Authentication" option.
        1. Set "Anonymous Authentication = "Enabled"
        2. All other to "Disabled"
        3. API Security Basic Anonymous Authentication

  2. Within the appsettings.json file found in your file folder.

    1. Ensure the "authentication type" setting is set to "Basic".

    2. See Authentification type below.

  3. Within the Safran Database

    1. Insert user and password into the "api_user" table of your Safran database, which the API is accessing.
    2. Notice that the API is no longer using the previous table named "user" since 25 June 2020.

Authentification Type

"AppSettings": {
  "SafranWebApiAuthenticationType": "Basic",
  ...
}


Create database table, MS SQL

SQL command

USE [Safran]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
 
CREATE TABLE [dbo].[api_user](
    [id] numeric(8,0) NOT NULL,
    [username] nvarchar(50) NOT NULL,
    [password] nvarchar(50) NOT NULL,
 CONSTRAINT [pk_api_user] PRIMARY KEY CLUSTERED ([id] ASC)
 WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

GRANT ALL ON api_user TO powerplan
GO

Add user to table, MS SQL

SQL command

use [Safran]
go

insert into dbo.[api_user] (id, username, password) values (1, 'safranwebapi', 'safran')
go

Create database table, Oracle

SQL command

create table API_USER (
 ID number(8,0) not null,
 USERNAME varchar2(50) not null,
 PASSWORD varchar2(50) not null,
 constraint PK_API_USER primary key (id)
)
tablespace safran_data;

grant all on API_USER to safran;

create public synonym API_USER for safransa.API_USER;

Add user to table, Oracle

SQL command

INSERT INTO API_USER (id, username, password) VALUES (1, 'safranwebapi', 'safran');


Was this article helpful?